Skip to content

Find, verify, and analyze leaked credentials

Correctly create azure git links. (#1743)

ahravc9e60866440d
diff --git a/pkg/giturl/giturl.go b/pkg/giturl/giturl.go
index 0fdc200e6..d35809840 100644
--- a/pkg/giturl/giturl.go
+++ b/pkg/giturl/giturl.go
@@ -132,9 +132,9 @@ func GenerateLink(repo, commit, file string, line int64) string {
return baseLink
case providerAzure:
- baseLink := repo + "?path=" + file + "&version=GB" + commit
+ baseLink := repo + "/commit/" + commit + "/" + file
if line > 0 {
- baseLink += "&line=" + strconv.FormatInt(line, 10)
+ baseLink += "?line=" + strconv.FormatInt(line, 10)
}
return baseLink
diff --git a/pkg/giturl/giturl_test.go b/pkg/giturl/giturl_test.go
index 69c0556ce..8035ba515 100644
--- a/pkg/giturl/giturl_test.go
+++ b/pkg/giturl/giturl_test.go
@@ -148,7 +148,7 @@ func TestGenerateLink(t *testing.T) {
commit: "abcdef",
file: "main.go",
},
- want: "https://dev.azure.com/org/project/_git/repo?path=main.go&version=GBabcdef",
+ want: "https://dev.azure.com/org/project/_git/repo/commit/abcdef/main.go",
},
{
name: "Azure link gen with line",
@@ -158,7 +158,7 @@ func TestGenerateLink(t *testing.T) {
file: "main.go",
line: int64(20),
},
- want: "https://dev.azure.com/org/project/_git/repo?path=main.go&version=GBabcdef&line=20",
+ want: "https://dev.azure.com/org/project/_git/repo/commit/abcdef/main.go?line=20",
},
}
for _, tt := range tests {