Fix Gitea remote URL parsing for repos with dots or special chars
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 5s
Build-Test-Publish / build (linux/arm64) (push) Successful in 11s

This commit is contained in:
j
2026-03-09 07:15:27 +13:00
parent ff0d1b18f5
commit 8bcc7fddc9

8
gp
View File

@@ -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