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
|
# Match https://TOKEN@HOST/OWNER/REPO.git or https://HOST/OWNER/REPO.git
|
||||||
local token="" host="" owner="" repo=""
|
local token="" host="" owner="" repo=""
|
||||||
if [[ "$remote_url" =~ ^https://([^@]+)@([^/]+)/([^/]+)/([^/]+?)(\.git)?$ ]]; then
|
if [[ "$remote_url" =~ ^https://([^@]+)@([^/]+)/([^/]+)/(.+)$ ]]; then
|
||||||
token="${BASH_REMATCH[1]}"
|
token="${BASH_REMATCH[1]}"
|
||||||
host="${BASH_REMATCH[2]}"
|
host="${BASH_REMATCH[2]}"
|
||||||
owner="${BASH_REMATCH[3]}"
|
owner="${BASH_REMATCH[3]}"
|
||||||
repo="${BASH_REMATCH[4]}"
|
repo="${BASH_REMATCH[4]%.git}"
|
||||||
elif [[ "$remote_url" =~ ^https://([^/]+)/([^/]+)/([^/]+?)(\.git)?$ ]]; then
|
elif [[ "$remote_url" =~ ^https://([^/]+)/([^/]+)/(.+)$ ]]; then
|
||||||
host="${BASH_REMATCH[1]}"
|
host="${BASH_REMATCH[1]}"
|
||||||
owner="${BASH_REMATCH[2]}"
|
owner="${BASH_REMATCH[2]}"
|
||||||
repo="${BASH_REMATCH[3]}"
|
repo="${BASH_REMATCH[3]%.git}"
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user