Skip to content

Commit 05868cc

Browse files
authored
fix(watch): don't panic on invalid file specifiers (denoland#26577)
Removes an unwrap that falsely assumed the specifier is a valid file path. Fixes denoland#26209
1 parent ab3d02a commit 05868cc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cli/graph_util.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,11 @@ impl deno_graph::source::Reporter for FileWatcherReporter {
10091009
) {
10101010
let mut file_paths = self.file_paths.lock();
10111011
if specifier.scheme() == "file" {
1012-
file_paths.push(specifier.to_file_path().unwrap());
1012+
// Don't trust that the path is a valid path at this point:
1013+
// https://github.com/denoland/deno/issues/26209.
1014+
if let Ok(file_path) = specifier.to_file_path() {
1015+
file_paths.push(file_path);
1016+
}
10131017
}
10141018

10151019
if modules_done == modules_total {

0 commit comments

Comments
 (0)