-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: do not panic running invalid file specifier #25530
fix: do not panic running invalid file specifier #25530
Conversation
@bartlomieju @dsherret |
…' into handle-invalid-path-error-denoland#20062
…' into handle-invalid-path-error-denoland#20062
…' into handle-invalid-path-error-denoland#20062
…' into handle-invalid-path-error-denoland#20062
… handle-invalid-path-error-denoland#20062 # Conflicts: # cli/graph_util.rs # cli/lsp/config.rs # runtime/permissions/lib.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
file:/// URL, it should successfully resolve to a valid file path
Head branch was pushed to by a user without write access
Why don’t we check if the file exists directly within the The current approach in For example, I insert this code to handle the running script to prevent it from panic if file doesn't exist like
I think we should handle the file existence check directly within If we centralize the file existence check in |
That would be slow. Additionally, we don't always use
That code didn't have a test that failed after it was removed and I don't believe it's the right approach (instead stuff should fail when it goes to load the file) |
This update prevents a panic in
specifier_to_file_path
on Windows by validating the file URL before callingto_file_path()
. It ensures that:Paths are checked to be absolute and are converted if needed.
The path is verified to exist before passing it to
to_file_path()
, ensuring invalid paths don't cause the application to crash.This fix gracefully handles invalid or non-standard file URLs, avoiding panics during path resolution.
fix #20056
Co-authored-by: Bedis Nbiba [email protected]