Reject invalid URLs from GBrowse providers

This commit is contained in:
Tim Pope
2022-06-26 17:13:51 -04:00
parent e80c460e48
commit 47cbfc00cc

View File

@@ -7457,19 +7457,14 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, ...) abor
let opts.path = s:sub(path, '/\=$', '/') let opts.path = s:sub(path, '/\=$', '/')
endif endif
let url = '' for l:.Handler in get(g:, 'fugitive_browse_handlers', [])
for Handler in get(g:, 'fugitive_browse_handlers', []) let l:.url = call(Handler, [copy(opts)])
let url = call(Handler, [copy(opts)]) if type(url) == type('') && url =~# '://'
if !empty(url) return s:BrowserOpen(url, a:mods, a:bang)
break
endif endif
endfor endfor
if empty(url) throw "fugitive: no GBrowse handler installed for '".raw."'"
throw "fugitive: no GBrowse handler installed for '".raw."'"
endif
return s:BrowserOpen(url, a:mods, a:bang)
catch /^fugitive:/ catch /^fugitive:/
return 'echoerr ' . string(v:exception) return 'echoerr ' . string(v:exception)
endtry endtry