From c8d229dbf03177e81f4fd2f43c7daf74a7f2e283 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Wed, 30 Oct 2024 00:35:42 +0100 Subject: [PATCH] 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 --- cli/util/progress_bar/renderer.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/util/progress_bar/renderer.rs b/cli/util/progress_bar/renderer.rs index a83ceb3334..6b08dada12 100644 --- a/cli/util/progress_bar/renderer.rs +++ b/cli/util/progress_bar/renderer.rs @@ -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(), );