From fefe93c91b63e35bf88f5f432f0cca09948d0623 Mon Sep 17 00:00:00 2001 From: crowlKats <13135287+crowlKats@users.noreply.github.com> Date: Mon, 12 Apr 2021 04:15:43 +0200 Subject: feat(runtime/permissions): prompt fallback (#9376) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yoshiya Hinosawa Co-authored-by: Bartek IwaƄczuk --- op_crates/fetch/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'op_crates/fetch/lib.rs') diff --git a/op_crates/fetch/lib.rs b/op_crates/fetch/lib.rs index 69c0c46ad..ae716af41 100644 --- a/op_crates/fetch/lib.rs +++ b/op_crates/fetch/lib.rs @@ -86,19 +86,19 @@ pub struct HttpClientDefaults { } pub trait FetchPermissions { - fn check_net_url(&self, _url: &Url) -> Result<(), AnyError>; - fn check_read(&self, _p: &Path) -> Result<(), AnyError>; + fn check_net_url(&mut self, _url: &Url) -> Result<(), AnyError>; + fn check_read(&mut self, _p: &Path) -> Result<(), AnyError>; } /// For use with `op_fetch` when the user does not want permissions. pub struct NoFetchPermissions; impl FetchPermissions for NoFetchPermissions { - fn check_net_url(&self, _url: &Url) -> Result<(), AnyError> { + fn check_net_url(&mut self, _url: &Url) -> Result<(), AnyError> { Ok(()) } - fn check_read(&self, _p: &Path) -> Result<(), AnyError> { + fn check_read(&mut self, _p: &Path) -> Result<(), AnyError> { Ok(()) } } @@ -161,7 +161,7 @@ where let scheme = url.scheme(); let (request_rid, request_body_rid) = match scheme { "http" | "https" => { - let permissions = state.borrow::(); + let permissions = state.borrow_mut::(); permissions.check_net_url(&url)?; let mut request = client.request(method, url); @@ -442,7 +442,7 @@ where FP: FetchPermissions + 'static, { if let Some(ca_file) = args.ca_file.clone() { - let permissions = state.borrow::(); + let permissions = state.borrow_mut::(); permissions.check_read(&PathBuf::from(ca_file))?; } -- cgit v1.2.3