mirror of
https://github.com/tpope/vim-rhubarb.git
synced 2025-12-07 04:34:27 +08:00
Handle trailing slash in enterprise URL
This commit is contained in:
@@ -26,9 +26,8 @@ endfunction
|
|||||||
function! rhubarb#HomepageForUrl(url) abort
|
function! rhubarb#HomepageForUrl(url) abort
|
||||||
let domain_pattern = 'github\.com'
|
let domain_pattern = 'github\.com'
|
||||||
let domains = get(g:, 'github_enterprise_urls', get(g:, 'fugitive_github_domains', []))
|
let domains = get(g:, 'github_enterprise_urls', get(g:, 'fugitive_github_domains', []))
|
||||||
call map(copy(domains), 'substitute(v:val, "/$", "", "")')
|
|
||||||
for domain in domains
|
for domain in domains
|
||||||
let domain_pattern .= '\|' . escape(split(domain, '://')[-1], '.')
|
let domain_pattern .= '\|' . escape(split(substitute(domain, '/$', '', ''), '://')[-1], '.')
|
||||||
endfor
|
endfor
|
||||||
let base = matchstr(a:url, '^\%(https\=://\%([^@/:]*@\)\=\|git://\|git@\|ssh://git@\)\=\zs\('.domain_pattern.'\)[/:].\{-\}\ze\%(\.git\)\=/\=$')
|
let base = matchstr(a:url, '^\%(https\=://\%([^@/:]*@\)\=\|git://\|git@\|ssh://git@\)\=\zs\('.domain_pattern.'\)[/:].\{-\}\ze\%(\.git\)\=/\=$')
|
||||||
if index(domains, 'http://' . matchstr(base, '^[^:/]*')) >= 0
|
if index(domains, 'http://' . matchstr(base, '^[^:/]*')) >= 0
|
||||||
|
|||||||
Reference in New Issue
Block a user