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
This commit is contained in:
Bartek Iwańczuk 2024-10-27 03:00:19 +00:00 committed by GitHub
parent ab3d02a081
commit 05868cc236
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 {