From 05868cc2367d6c827691d7624478157239048bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 27 Oct 2024 03:00:19 +0000 Subject: [PATCH] fix(watch): don't panic on invalid file specifiers (#26577) Removes an unwrap that falsely assumed the specifier is a valid file path. Fixes https://github.com/denoland/deno/issues/26209 --- cli/graph_util.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cli/graph_util.rs b/cli/graph_util.rs index e67ae7821b6e35..2eaee228afbd92 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -1009,7 +1009,11 @@ impl deno_graph::source::Reporter for FileWatcherReporter { ) { let mut file_paths = self.file_paths.lock(); if specifier.scheme() == "file" { - file_paths.push(specifier.to_file_path().unwrap()); + // Don't trust that the path is a valid path at this point: + // https://github.com/denoland/deno/issues/26209. + if let Ok(file_path) = specifier.to_file_path() { + file_paths.push(file_path); + } } if modules_done == modules_total {