@@ -121,6 +121,8 @@ func GenerateLink(repo, commit, file string, line int64) string {
121
121
// Some paths contain '%' which breaks |url.Parse| if not encoded.
122
122
// https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding
123
123
file = strings .ReplaceAll (file , "%" , "%25" )
124
+ file = strings .ReplaceAll (file , "[" , "%5B" )
125
+ file = strings .ReplaceAll (file , "]" , "%5D" )
124
126
125
127
switch determineProvider (repo ) {
126
128
case providerBitbucket :
@@ -175,6 +177,8 @@ var linePattern = regexp.MustCompile(`L\d+`)
175
177
// Used post-link generation to refine reported issue locations within large scanned blocks.
176
178
func UpdateLinkLineNumber (ctx context.Context , link string , newLine int64 ) string {
177
179
link = strings .Replace (link , "%" , "%25" , - 1 )
180
+ link = strings .Replace (link , "[" , "%5B" , - 1 )
181
+ link = strings .Replace (link , "]" , "%5D" , - 1 )
178
182
parsedURL , err := url .Parse (link )
179
183
if err != nil {
180
184
ctx .Logger ().Error (err , "unable to parse link to update line number" , "link" , link )
0 commit comments