1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-22 08:42:32 -05:00

Fix filePreviewPattern

This commit is contained in:
Mai-Lapyst 2024-03-16 00:35:56 +01:00
parent fae8d9f70d
commit 6721cba75b
No known key found for this signature in database
GPG key ID: F88D929C09E239F8

View file

@ -65,7 +65,7 @@ var (
validLinksPattern = regexp.MustCompile(`^[a-z][\w-]+://`)
// filePreviewPattern matches "http://domain/org/repo/src/commit/COMMIT/filepath#L1-L2"
filePreviewPattern = regexp.MustCompile(`https?://((?:\S+/){4,5})src/commit/([0-9a-f]{4,64})/(\S+)#(L\d+(?:-L\d+)?)`)
filePreviewPattern = regexp.MustCompile(`https?://((?:\S+/){3})src/commit/([0-9a-f]{4,64})/(\S+)#(L\d+(?:-L\d+)?)`)
// While this email regex is definitely not perfect and I'm sure you can come up
// with edge cases, it is still accepted by the CommonMark specification, as