Skip to content

netrw: Opening a URI-encoded URL by gx will open corrupted URL #16252

@KSR-Yasuda

Description

@KSR-Yasuda

Steps to reproduce

  1. Write some URL-encoded URL such as https://www.example.com/#:~:text=%E3%81%82 in some buffer.
  2. Put cursor on the URL, and run gx shortcut (= NetrwBrowseX) in normal mode.
  3. It tries to open the target URL in the web browser, but the opening page URL is corrupted
    like https://www.example.com/#:~:text=/%E3/%81/%82.

Here it is calling extra escape() that causes this.
Due to this, it would fails with paths including # or %, the characters escaped here.

The comment for it says they've added the escape() since shellescape(..., 1) in netrw#Open() is insufficient.

Is the escape() really required now?

Expected behaviour

It opens the correct URL.

Version of Vim

9.1.866

Environment

  • Operating system: Windows 11 Pro 64bit 24H2 (Version 10.0.26100.2605)

    • MSYS2 (msys2-runtime 3.5.4-8)
  • Terminal: mintty '3.7.6' 2024-09-24_05:10 (x86_64-pc-msys)

    • Value of $TERM: xterm-256color
    • Shell: GNU bash, version 5.2.37(1)-release (x86_64-pc-msys)
  • Vim g:netrw_browsex_viewer value: start

  • Browser: Google Chrome v131.0.6778.140

Logs and stack traces

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions