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

vscode.Uri.parse does not work for urls with %2F #112577

Closed
alonstern opened this issue Dec 15, 2020 · 2 comments
Closed

vscode.Uri.parse does not work for urls with %2F #112577

alonstern opened this issue Dec 15, 2020 · 2 comments
Assignees

Comments

@alonstern
Copy link

alonstern commented Dec 15, 2020

  • VSCode Version: 1.51.1
  • OS Version: Mac

I am using vscode.env.openExternal and vscode.Uri.parse to open external URL in the browser.
My problem is that my URL contains '%2F' (which is the escaped value of '/') in its path (e.g., something like https://aaa/bbb%2Fccc).
It seems the Uri.parse unescapes the URL and than escape it again in openExternal, however:

unescape('https://aaa/bbb%2Fccc') // https://aaa/bbb/ccc
escape('https://aaa/bbb/ccc') // https://aaa/bbb/ccc

(Assuming the builtins unescape and escape are used)
And thus, it removed the escaping of '%2F' and opening the wrong page in the browser.

Thanks

Does this issue occur when all extensions are disabled?: Yes

@jrieken
Copy link
Member

jrieken commented Dec 15, 2020

Yes, this is the unfortunate truth. You will find some duplicates of this issue and honest, good attempts in fixing them. Which I all had to revert because too many extensions depend on the current, broken behaviour. It is a mess and unfortunately too late to properly fix. The current strategy is to allow string in addition to Uri in some places. See #85930 and issues linked from there

@alonstern
Copy link
Author

@jrieken thanks for the answer.
I think even adding an "escape" flag to the parse function which its default is true, or creating a new fixed URI type, to avoid breaking to current behavior would be a major improvement.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants