Fix Gitea remote URL parsing for repos with dots or special chars
This commit is contained in:
8
gp
8
gp
@@ -485,15 +485,15 @@ parse_gitea_remote() {
|
||||
|
||||
# Match https://TOKEN@HOST/OWNER/REPO.git or https://HOST/OWNER/REPO.git
|
||||
local token="" host="" owner="" repo=""
|
||||
if [[ "$remote_url" =~ ^https://([^@]+)@([^/]+)/([^/]+)/([^/]+?)(\.git)?$ ]]; then
|
||||
if [[ "$remote_url" =~ ^https://([^@]+)@([^/]+)/([^/]+)/(.+)$ ]]; then
|
||||
token="${BASH_REMATCH[1]}"
|
||||
host="${BASH_REMATCH[2]}"
|
||||
owner="${BASH_REMATCH[3]}"
|
||||
repo="${BASH_REMATCH[4]}"
|
||||
elif [[ "$remote_url" =~ ^https://([^/]+)/([^/]+)/([^/]+?)(\.git)?$ ]]; then
|
||||
repo="${BASH_REMATCH[4]%.git}"
|
||||
elif [[ "$remote_url" =~ ^https://([^/]+)/([^/]+)/(.+)$ ]]; then
|
||||
host="${BASH_REMATCH[1]}"
|
||||
owner="${BASH_REMATCH[2]}"
|
||||
repo="${BASH_REMATCH[3]}"
|
||||
repo="${BASH_REMATCH[3]%.git}"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user