From 26edb1153dbf6b972266d3ac4f3ca5e29cedfe53 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Jun 21 2021 08:51:45 +0000 Subject: Fix removal of `.git` suffix. The intention is to remove the `.git` that may be added to, e.g., GitHub repository URLs. If there's a `/v2` or similar after, then we want to match a slash with the suffix. If the suffix is at the end, then the earlier code would have appended a slash _anyway_, and so we still want to match a slash. Allowing `.git` without slash incorrectly catches things like the middle of `code.gitea.com`. --- diff --git a/rpm/lua/srpm/go.lua b/rpm/lua/srpm/go.lua index a4a8148..9708262 100644 --- a/rpm/lua/srpm/go.lua +++ b/rpm/lua/srpm/go.lua @@ -28,7 +28,7 @@ local function rpmname(goipath, compatid) -- remove eventual protocol prefix goname = string.gsub(goname, "^http(s?)://", "") -- remove eventual .git suffix - goname = string.gsub(goname, "%.git/*", "") + goname = string.gsub(goname, "%.git/+", "") -- remove eventual git. prefix goname = string.gsub(goname, "^git%.", "") -- remove FQDN root (.com, .org, etc)