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