From 9a63f4f86064a047bfb3e4003ff71627d52e6efa Mon Sep 17 00:00:00 2001 From: xq114 <1140735506@qq.com> Date: Thu, 23 Feb 2023 19:39:56 +0800 Subject: deduplicate match --- xmake/modules/private/action/require/impl/utils/url_filename.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/xmake/modules/private/action/require/impl/utils/url_filename.lua b/xmake/modules/private/action/require/impl/utils/url_filename.lua index 9694964ea..c0d472e6d 100644 --- a/xmake/modules/private/action/require/impl/utils/url_filename.lua +++ b/xmake/modules/private/action/require/impl/utils/url_filename.lua @@ -26,15 +26,13 @@ end -- get filename from github name mangling function github_filename(url) - if url:find("^https://github.com/[^/]-/[^/]-/archive/") then - local reponame = url:match("^https://github.com/[^/]-/([^/]-)/archive/") + local reponame = url:match("^https://github.com/[^/]-/([^/]-)/archive/") + if reponame then local filename = raw_filename(url) if filename:find("^v%d") then filename = filename:match("^v(.+)") end - if reponame and filename then - return reponame .. "-" .. filename - end + return reponame .. "-" .. filename end end -- cgit v1.3.1