fix(install): percent encodings in interactive progress bar (#26600)

Fixes percent encodings showing up when installing scoped packages via
`deno add` or `deno install`. The issue is caused by us trying to map
back the package name from the resolved http url. This doesn't and has
never worked with private registries. The proper solution would be to
pass the original specifier into here, but that's a bit of a bigger
refactor.

So for now the quickest workaround is to replace `%2f` back to `/`.

Fixes https://github.com/denoland/deno/issues/26576
This commit is contained in:
Marvin Hagemeister 2024-10-30 00:35:42 +01:00 committed by GitHub
parent 3b28446000
commit c8d229dbf0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -193,10 +193,16 @@ impl ProgressBarRenderer for TextOnlyProgressBarRenderer {
}
};
// TODO(@marvinhagemeister): We're trying to reconstruct the original
// specifier from the resolved one, but we lack the information about
// private registries URLs and other things here.
let message = display_entry
.message
.replace("https://registry.npmjs.org/", "npm:")
.replace("https://jsr.io/", "jsr:");
.replace("https://jsr.io/", "jsr:")
.replace("%2f", "/")
.replace("%2F", "/");
display_str.push_str(
&colors::gray(format!(" - {}{}\n", message, bytes_text)).to_string(),
);