diff options
author | Paulo Gomes <pjbgf@linux.com> | 2023-04-17 22:32:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-17 22:32:45 +0100 |
commit | 7cd387bd28a95590d9536b4344d4ff60b75d6590 (patch) | |
tree | 1e554491e9b2590de784351893f3b6ff19f4c382 /internal/url/url.go | |
parent | b154dcce7059e4e02f8798db158b6a76ffc4a63e (diff) | |
parent | a71389b9d9293a6fefc3c923e765f250235a5262 (diff) | |
download | go-git-7cd387bd28a95590d9536b4344d4ff60b75d6590.tar.gz |
Merge pull request #715 from jotadrilo/fix/csp-like
internal: Fix regression in scp-like match
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 |