From 8bcc7fddc93f71674a741e80a21804b9bd8885cc Mon Sep 17 00:00:00 2001 From: j Date: Mon, 9 Mar 2026 07:15:27 +1300 Subject: [PATCH] Fix Gitea remote URL parsing for repos with dots or special chars --- gp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gp b/gp index 9dd2bde..3454f5c 100755 --- a/gp +++ b/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