mirror of
https://github.com/denoland/deno.git
synced 2024-12-21 23:04:45 -05:00
fix: linux canonicalization checks (#24641)
<!-- Before submitting a PR, please read https://docs.deno.com/runtime/manual/references/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. 7. Open as a draft PR if your work is still in progress. The CI won't run all steps, but you can add '[ci]' to a commit message to force it to. 8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label. -->
This commit is contained in:
parent
7bfcb4dd10
commit
ee3829a778
1 changed files with 4 additions and 2 deletions
|
@ -1069,8 +1069,10 @@ fn open_with_access_check(
|
|||
};
|
||||
(*access_check)(false, &path, &options)?;
|
||||
// On Linux, /proc may contain magic links that we don't want to resolve
|
||||
let needs_canonicalization = !is_windows_device_path
|
||||
&& (!cfg!(target_os = "linux") || path.starts_with("/proc"));
|
||||
let is_linux_special_path = cfg!(target_os = "linux")
|
||||
&& (path.starts_with("/proc") || path.starts_with("/dev"));
|
||||
let needs_canonicalization =
|
||||
!is_windows_device_path && !is_linux_special_path;
|
||||
let path = if needs_canonicalization {
|
||||
match path.canonicalize() {
|
||||
Ok(path) => path,
|
||||
|
|
Loading…
Reference in a new issue