Skip to content

Commit 1d0d274

Browse files
Copilotpremun
andcommitted
Fix PR URL conversion from API to web format in PullRequestController
Co-authored-by: premun <[email protected]>
1 parent 582fd65 commit 1d0d274

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/ProductConstructionService/ProductConstructionService.Api/Api/v2020_02_20/Controllers/PullRequestController.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,23 @@ private static TrackedPullRequest ToTrackedPullRequest(
210210
string subscriptionId,
211211
Maestro.Data.Models.Subscription? subscription)
212212
{
213+
string? org = null;
214+
string? repoName = null;
215+
if (subscription != null && GitRepoUrlUtils.ParseTypeFromUri(subscription.TargetRepository) == GitRepoType.AzureDevOps)
216+
{
217+
try
218+
{
219+
(repoName, org) = GitRepoUrlUtils.GetRepoNameAndOwner(subscription.TargetRepository);
220+
}
221+
catch
222+
{
223+
// Repos which do not conform to usual naming will not be handled
224+
}
225+
}
226+
213227
return new TrackedPullRequest(
214228
subscriptionId,
215-
pr.Url,
229+
TurnApiUrlToWebsite(pr.Url, org, repoName),
216230
subscription?.Channel != null ? new Channel(subscription.Channel) : null,
217231
subscription?.TargetBranch,
218232
subscription?.SourceEnabled ?? false,

0 commit comments

Comments
 (0)