Skip to content

Commit

Permalink
fix(watch): don't panic on invalid file specifiers (#26577)
Browse files Browse the repository at this point in the history
Removes an unwrap that falsely assumed the specifier is a valid
file path.

Fixes #26209
  • Loading branch information
bartlomieju committed Oct 29, 2024
1 parent ec0e7dd commit 2d2928c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cli/graph_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2d2928c

Please sign in to comment.