Add ability to skip aggressive vscode.Uri encoding #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is related to a bug present in
mindaro-dev.file-downloader
: microsoft/vscode-file-downloader#56, and the relevant pull request to fix it: microsoft/vscode-file-downloader#57When trying to use this extension to download any file through a URL containing query parameters, the Uri is too aggressively encoded resulting in a 400 Bad Request (and no file downloaded).
A good example:
Original URL:
http://localhost:8081/service/rest/v1/search/assets/download?group=org.osgi&name=org.osgi.core&version=4.3.1&maven.extension=jar&maven.classifier
when encoded, becomes
http://localhost:8081/service/rest/v1/search/assets/download?group%3Dorg.osgi%26name%3Dorg.osgi.core%26version%3D4.3.1%26maven.extension%3Djar%26maven.classifier
, resulting in a bad request since the query parameters were incorrectly encoded.This is due to a change in how
vscode.Uri.toString()
works, where an optional parameter was added that allowed inputted URLs to bypass aggressive encoding (since too many extensions depended on the over-aggressive encoding functionality). However, this breaks query parameters as&
and=
are encoded, causing URLs to break.vscode.Uri.toString(true)
bypasses this aggressive encoding and allows URLs with query parameters to work.The issue in specific lies in
FileDownloader.ts
on line 118:There is already a PR out for fixing this bug: microsoft/vscode-file-downloader#57, however the changes also need to be mirrored to the API so that Typescript programs can take advantage of the new optional parameter. This PR mirrors the necessary changes.