From f0fe3df0a63dca8a9861fefd76c05f033f5d567d Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Thu, 7 Dec 2023 17:21:09 +0100 Subject: [PATCH] tools.vpm: be more specific, when handling `.git` endings (#20110) --- cmd/tools/vpm/common.v | 2 +- cmd/tools/vpm/parse.v | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/tools/vpm/common.v b/cmd/tools/vpm/common.v index 5d8c228e26..42763cb0b6 100644 --- a/cmd/tools/vpm/common.v +++ b/cmd/tools/vpm/common.v @@ -108,8 +108,8 @@ fn get_ident_from_url(raw_url string) !(string, string) { publisher, mut name := url.path.trim_left('/').rsplit_once('/') or { return error('failed to retrieve module name for `${url}`.') } + name = name.trim_string_right('.git') vpm_log(@FILE_LINE, @FN, 'raw_url: ${raw_url}; publisher: ${publisher}; name: ${name}') - name = if name.ends_with('.git') { name.replace('.git', '') } else { name } return publisher, name } diff --git a/cmd/tools/vpm/parse.v b/cmd/tools/vpm/parse.v index 8a2cfbd9ff..641c43ca8f 100644 --- a/cmd/tools/vpm/parse.v +++ b/cmd/tools/vpm/parse.v @@ -188,7 +188,7 @@ fn fetch_manifest(name string, url string, version string, is_git bool) !vmod.Ma } head_branch.output.all_after_last('/').all_before(' ').all_before('\t') } - url_ := if url.ends_with('.git') { url.replace('.git', '') } else { url } + url_ := url.trim_string_right('.git') // Scan both URLS. E.g.: // https://github.com/publisher/module/raw/v0.7.0/v.mod // https://gitlab.com/publisher/module/-/raw/main/v.mod