Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] '<,'>GBrowse attaches %5C in URL before the # character #2354

Open
embe221ed opened this issue Nov 8, 2024 · 4 comments
Open

[bug] '<,'>GBrowse attaches %5C in URL before the # character #2354

embe221ed opened this issue Nov 8, 2024 · 4 comments

Comments

@embe221ed
Copy link
Contributor

after this commit, and because of this line the # character used to point to a specific line/range of lines is escaped, causing the opened URL to look like this: <path_to_file>%5C#<lines> which results in 404 Not Found error. Confirmed this by removing the escape() call from the mentioned line and re-building neovim

@tpope
Copy link
Owner

tpope commented Nov 14, 2024

A possible fix would be to use netrw#Open() if available, and update the escaping to match. That way older versions of Vim can still work with the old behavior of netrw#BrowseX().

@embe221ed
Copy link
Contributor Author

embe221ed commented Nov 19, 2024

fortunately, most of the escaping in netrw#BrowseX doesn't seem to actually be applied to the url in this case. I think that checking if has('nvim-<version>') && exists('*netrw#Open') can be sufficient enough
i.e.

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
index 17fd04d..9dba547 100644
--- a/autoload/fugitive.vim
+++ b/autoload/fugitive.vim
@@ -7437,7 +7437,9 @@ function! s:BrowserOpen(url, mods, echo_copy) abort
     if !exists('g:loaded_netrw')
       runtime! autoload/netrw.vim
     endif
-    if exists('*netrw#BrowseX')
+    if has('nvim-0.11') && exists('*netrw#Open')
+      return 'echo '.string(url).'|' . mods . 'call netrw#Open('.string(url).')'
+    elseif exists('*netrw#BrowseX')
       return 'echo '.string(url).'|' . mods . 'call netrw#BrowseX('.string(url).', 0)'
     elseif exists('*netrw#NetrwBrowseX')
       return 'echo '.string(url).'|' . mods . 'call netrw#NetrwBrowseX('.string(url).', 0)'

@praiskup
Copy link

praiskup commented Dec 9, 2024

The same happens with vim v9.1.906 on Fedora 41.

@sluongng
Copy link

Im also affected by this as I have a custom browse handler with # in the URL https://github.com/sluongng/dotfiles/blob/aae4e38389defc08b7e97745fda9836cb39e2ce5/config/nvim/init.lua#L551-L556

Would love to get the PR merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants