···1010 "path"
1111 "path/filepath"
1212 "regexp"
1313+ "slices"
1314 "strconv"
1415 "strings"
1516 "sync"
···6465 validLinksPattern = regexp.MustCompile(`^[a-z][\w-]+://`)
65666667 // filePreviewPattern matches "http://domain/org/repo/src/commit/COMMIT/filepath#L1-L2"
6767- filePreviewPattern = regexp.MustCompile(`https?://((?:\S+/){3})src/commit/([0-9a-f]{7,64})/(\S+)#(L\d+(?:-L\d+)?)`)
6868+ filePreviewPattern = regexp.MustCompile(`https?://((?:\S+/){4,5})src/commit/([0-9a-f]{7,64})/(\S+)#(L\d+(?:-L\d+)?)`)
68696970 // While this email regex is definitely not perfect and I'm sure you can come up
7071 // with edge cases, it is still accepted by the CommonMark specification, as
···10751076 return
10761077 }
1077107810781078- // Ensure that every group (m[0]...m[9]) has a match
10791079- for i := 0; i < 10; i++ {
10801080- if m[i] == -1 {
10811081- return
10821082- }
10791079+ // Ensure that every group has a match
10801080+ if slices.Contains(m, -1) {
10811081+ return
10831082 }
1084108310851084 urlFull := node.Data[m[0]:m[1]]
···10891088 return
10901089 }
1091109010921092- projPath := node.Data[m[2]:m[3]]
10931093- projPath = strings.TrimSuffix(projPath, "/")
10911091+ projPath := strings.TrimSuffix(node.Data[m[2]:m[3]], "/")
1094109210951093 commitSha := node.Data[m[4]:m[5]]
10961094 filePath := node.Data[m[6]:m[7]]