motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit 47cbfc00ccc2d4b951bef8ccfb3b8f3cc83b4e58 (tree)
parent e80c460e484d4d9168b8f63415589bfeef3bab0d
Author: Tim Pope <code@tpope.net>
Date:   Sun, 26 Jun 2022 17:13:51 -0400

Reject invalid URLs from GBrowse providers

Diffstat:
Mautoload/fugitive.vim | 15+++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

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