Skip to content

Commit

Permalink
Fix web issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rscarson committed Oct 17, 2024
1 parent 77db90b commit 41ea62e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/ext/web/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,13 @@ impl WebPermissions for AllowlistWebPermissions {
}
}

fn check_write(&self, p: &Path, api_name: &str) -> Result<(), deno_core::error::AnyError> {
fn check_write<'a>(
&self,
p: &'a Path,
api_name: &str,
) -> Result<Cow<'a, Path>, deno_core::error::AnyError> {
if self.0.borrow().write_paths.contains(p.to_str().unwrap()) {
Ok(())
Ok(Cow::Borrowed(p))
} else {
Err(anyhow!(
"Path '{}' is not allowed to be written to",
Expand Down

0 comments on commit 41ea62e

Please sign in to comment.