From 0eaa213f013802ace671ec652631c654bf7cad9e Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 8 Apr 2020 07:20:10 -0400 Subject: [PATCH] Handle trailing slash in enterprise URL --- autoload/rhubarb.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/autoload/rhubarb.vim b/autoload/rhubarb.vim index b38aaab..c6bf819 100644 --- a/autoload/rhubarb.vim +++ b/autoload/rhubarb.vim @@ -26,9 +26,8 @@ endfunction function! rhubarb#HomepageForUrl(url) abort let domain_pattern = 'github\.com' let domains = get(g:, 'github_enterprise_urls', get(g:, 'fugitive_github_domains', [])) - call map(copy(domains), 'substitute(v:val, "/$", "", "")') for domain in domains - let domain_pattern .= '\|' . escape(split(domain, '://')[-1], '.') + let domain_pattern .= '\|' . escape(split(substitute(domain, '/$', '', ''), '://')[-1], '.') endfor let base = matchstr(a:url, '^\%(https\=://\%([^@/:]*@\)\=\|git://\|git@\|ssh://git@\)\=\zs\('.domain_pattern.'\)[/:].\{-\}\ze\%(\.git\)\=/\=$') if index(domains, 'http://' . matchstr(base, '^[^:/]*')) >= 0