diff options
Diffstat (limited to 'runtime/permissions.rs')
-rw-r--r-- | runtime/permissions.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/runtime/permissions.rs b/runtime/permissions.rs index a331ef3e9..70d243cb0 100644 --- a/runtime/permissions.rs +++ b/runtime/permissions.rs @@ -580,16 +580,16 @@ impl Permissions { specifier: &ModuleSpecifier, ) -> Result<(), AnyError> { let url = specifier.as_url(); - if url.scheme() == "file" { - match url.to_file_path() { + match url.scheme() { + "file" => match url.to_file_path() { Ok(path) => self.check_read(&path), Err(_) => Err(uri_error(format!( "Invalid file path.\n Specifier: {}", specifier ))), - } - } else { - self.check_net_url(url) + }, + "data" => Ok(()), + _ => self.check_net_url(url), } } @@ -920,6 +920,13 @@ mod tests { .unwrap(), false, ), + ( + ModuleSpecifier::resolve_url_or_path( + "data:text/plain,Hello%2C%20Deno!", + ) + .unwrap(), + true, + ), ]; if cfg!(target_os = "windows") { |