From 7a22df9b7641274b2a83ce53845215d17cfda2c8 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Wed, 13 Oct 2021 18:04:44 +0100 Subject: fix(runtime/ops/worker_host): move permission arg parsing to Rust (#12297) --- ext/ffi/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/ffi/lib.rs b/ext/ffi/lib.rs index 4b83070d3..f1e593296 100644 --- a/ext/ffi/lib.rs +++ b/ext/ffi/lib.rs @@ -20,6 +20,8 @@ use std::cell::RefCell; use std::collections::HashMap; use std::convert::TryFrom; use std::ffi::c_void; +use std::path::Path; +use std::path::PathBuf; use std::rc::Rc; pub struct Unstable(pub bool); @@ -37,7 +39,7 @@ fn check_unstable(state: &OpState, api_name: &str) { } pub trait FfiPermissions { - fn check(&mut self, path: &str) -> Result<(), AnyError>; + fn check(&mut self, path: &Path) -> Result<(), AnyError>; } #[derive(Clone)] @@ -366,7 +368,7 @@ where check_unstable(state, "Deno.dlopen"); let permissions = state.borrow_mut::(); - permissions.check(&path)?; + permissions.check(&PathBuf::from(&path))?; let lib = Library::open(&path).map_err(|e| { dlopen::Error::OpeningLibraryError(std::io::Error::new( -- cgit v1.2.3