Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
feat(git): only generate line numbers > 0 (#1898)
Richard Gomezb46fb75c73bf
diff --git a/pkg/giturl/giturl.go b/pkg/giturl/giturl.goindex bf7adee04..737167da0 100644--- a/pkg/giturl/giturl.go+++ b/pkg/giturl/giturl.go@@ -158,6 +158,11 @@ func UpdateLinkLineNumber(ctx context.Context, link string, newLine int64) strinreturn link}+ if newLine <= 0 {+ // Don't change the link if the line number is 0.+ return link+ }+switch determineProvider(link) {case providerBitbucket:// For Bitbucket, it doesn't support line links (based on the GenerateLink function).diff --git a/pkg/giturl/giturl_test.go b/pkg/giturl/giturl_test.goindex 1ccc2fd74..59bb01436 100644--- a/pkg/giturl/giturl_test.go+++ b/pkg/giturl/giturl_test.go@@ -251,6 +251,14 @@ func TestUpdateLinkLineNumber(t *testing.T) {},want: "https://onprem.customdomain.com/org/repo/commit/xyz123#L50",},+ {+ name: "Don't include line when it's 0",+ args: args{+ link: "https://github.com/coinbase/cbpay-js/issues/181",+ newLine: int64(0),+ },+ want: "https://github.com/coinbase/cbpay-js/issues/181",+ },{name: "Invalid link",args: args{