diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-10-27 03:00:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-27 08:30:19 +0530 |
commit | 05868cc2367d6c827691d7624478157239048bea (patch) | |
tree | 05f04bf4dc3e89de97371ea0c4ae45522bdf4c7c | |
parent | ab3d02a08174042c6337d130b02a6fa0f85673d2 (diff) |
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
-rw-r--r-- | cli/graph_util.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cli/graph_util.rs b/cli/graph_util.rs index e67ae7821..2eaee228a 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 { |