From d9cdc6788b1ed89d7f3b2daf9da7e4a9f664e424 Mon Sep 17 00:00:00 2001 From: "Kevin (Kun) \"Kassimo\" Qian" Date: Thu, 9 May 2019 09:20:34 -0700 Subject: fix: support relative path for whitelisting (#2317) Using `std::fs::canonicalize` to expand path to full existing path, such that later attempt to loop-pop and compare path segment would work. --- cli/ops.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'cli/ops.rs') diff --git a/cli/ops.rs b/cli/ops.rs index a1d6e0c48..610304aea 100644 --- a/cli/ops.rs +++ b/cli/ops.rs @@ -2,7 +2,7 @@ use atty; use crate::ansi; use crate::compiler::get_compiler_config; -use crate::deno_dir; +use crate::deno_dir::resolve_path; use crate::dispatch_minimal::dispatch_minimal; use crate::dispatch_minimal::parse_min_record; use crate::errors; @@ -241,14 +241,6 @@ pub fn op_selector_std(inner_type: msg::Any) -> Option { } } -fn resolve_path(path: &str) -> Result<(PathBuf, String), DenoError> { - let url = deno_dir::resolve_file_url(path.to_string(), ".".to_string()) - .map_err(DenoError::from)?; - let path = url.to_file_path().unwrap(); - let path_string = path.to_str().unwrap().to_string(); - Ok((path, path_string)) -} - // Returns a milliseconds and nanoseconds subsec // since the start time of the deno runtime. // If the High precision flag is not set, the -- cgit v1.2.3