diff options
author | Joseda Rios <josriolop@gmail.com> | 2023-03-16 15:20:01 +0100 |
---|---|---|
committer | Joseda Rios <josriolop@gmail.com> | 2023-04-15 16:05:43 +0200 |
commit | a71389b9d9293a6fefc3c923e765f250235a5262 (patch) | |
tree | 1e7972df2c3952af2ee1070c010ced1ad981910a /internal/url/url.go | |
parent | 3f1cfde283c93f33218c807602e93d47f72f7b90 (diff) | |
download | go-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.go | 6 |
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 |