summaryrefslogtreecommitdiff
path: root/ext/node/ops.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-03-13 13:50:23 -0400
committerGitHub <noreply@github.com>2023-03-13 18:50:23 +0100
commite8f22c076525c2fa55115349157f67085df287bf (patch)
treedf4105ee11bd69a4de1a138a26d6b44bca131ea1 /ext/node/ops.rs
parent4c2aeb250241fff5084cf31747ab53f4a0ecad79 (diff)
refactor(core): pass cwd explicitly to resolve_path (#18092)
Towards landing #15454
Diffstat (limited to 'ext/node/ops.rs')
-rw-r--r--ext/node/ops.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/node/ops.rs b/ext/node/ops.rs
index 046578ca5..fc192637a 100644
--- a/ext/node/ops.rs
+++ b/ext/node/ops.rs
@@ -1,5 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+use deno_core::anyhow::Context;
use deno_core::error::generic_error;
use deno_core::error::AnyError;
use deno_core::normalize_path;
@@ -93,10 +94,13 @@ where
P: NodePermissions + 'static,
{
// Guarantee that "from" is absolute.
- let from = deno_core::resolve_path(&from)
- .unwrap()
- .to_file_path()
- .unwrap();
+ let from = deno_core::resolve_path(
+ &from,
+ &std::env::current_dir().context("Unable to get CWD")?,
+ )
+ .unwrap()
+ .to_file_path()
+ .unwrap();
ensure_read_permission::<P>(state, &from)?;