aboutsummaryrefslogtreecommitdiffstats
path: root/internal/url/url.go
diff options
context:
space:
mode:
authorJoseda Rios <josriolop@gmail.com>2023-03-16 15:20:01 +0100
committerJoseda Rios <josriolop@gmail.com>2023-04-15 16:05:43 +0200
commita71389b9d9293a6fefc3c923e765f250235a5262 (patch)
tree1e7972df2c3952af2ee1070c010ced1ad981910a /internal/url/url.go
parent3f1cfde283c93f33218c807602e93d47f72f7b90 (diff)
downloadgo-git-a71389b9d9293a6fefc3c923e765f250235a5262.tar.gz
internal: Fix regression in csp-like match
Signed-off-by: Joseda Rios <josriolop@gmail.com>
Diffstat (limited to 'internal/url/url.go')
-rw-r--r--internal/url/url.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/url/url.go b/internal/url/url.go
index 14cf133..2662448 100644
--- a/internal/url/url.go
+++ b/internal/url/url.go
@@ -5,8 +5,10 @@ import (
)
var (
- isSchemeRegExp = regexp.MustCompile(`^[^:]+://`)
- scpLikeUrlRegExp = regexp.MustCompile(`^(?:(?P<user>[^@]+)@)?(?P<host>[^:\s]+):(?:(?P<port>[0-9]{1,5})(?:\/|:))?(?P<path>[^\\].*\/[^\\].*)$`)
+ isSchemeRegExp = regexp.MustCompile(`^[^:]+://`)
+
+ // Ref: https://github.com/git/git/blob/master/Documentation/urls.txt#L37
+ scpLikeUrlRegExp = regexp.MustCompile(`^(?:(?P<user>[^@]+)@)?(?P<host>[^:\s]+):(?:(?P<port>[0-9]{1,5}):)?(?P<path>[^\\].*)$`)
)
// MatchesScheme returns true if the given string matches a URL-like