Skip to content

Commit

Permalink
stamp: reflect upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyannyacha committed Jul 31, 2024
1 parent 9ef612f commit 5239160
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions crates/sb_core/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use deno_core::error::{custom_error, generic_error, AnyError};
use deno_core::url::Url;
use deno_fs::OpenOptions;
use deno_permissions::NetDescriptor;
use fqdn::fqdn;
use std::borrow::Cow;
use std::path::Path;

Expand Down Expand Up @@ -67,11 +66,8 @@ impl deno_fetch::FetchPermissions for Permissions {
}

if let Some(allow_net) = &self.allow_net {
let hostname = url
.host_str()
.ok_or(generic_error("empty host"))?
.to_string();
let descriptor = NetDescriptor(fqdn!(&hostname), url.port());
let hostname = url.host_str().ok_or(generic_error("empty host"))?.parse()?;
let descriptor = NetDescriptor(hostname, url.port());
if !allow_net.contains(&descriptor) {
return Err(custom_error(
"PermissionDenied",
Expand Down Expand Up @@ -132,11 +128,8 @@ impl deno_websocket::WebSocketPermissions for Permissions {
));
}
if let Some(allow_net) = &self.allow_net {
let hostname = url
.host_str()
.ok_or(generic_error("empty host"))?
.to_string();
let descriptor = NetDescriptor(fqdn!(&hostname), url.port());
let hostname = url.host_str().ok_or(generic_error("empty host"))?.parse()?;
let descriptor = NetDescriptor(hostname, url.port());
if !allow_net.contains(&descriptor) {
return Err(custom_error(
"PermissionDenied",
Expand Down

0 comments on commit 5239160

Please sign in to comment.