diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2021-01-06 13:22:38 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-06 13:22:38 +1100 |
commit | 54240c22af6233d1d977d469868b0d9050cad6da (patch) | |
tree | 81af9892f8728852387fad9c2d243ab933de927f /runtime/permissions.rs | |
parent | 60c9c857584bf5180dd0f7b937683dd9691aef84 (diff) |
feat(cli): support data urls (#8866)
Closes: #5059
Co-authored-by: Valentin Anger <syrupthinker@gryphno.de>
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") { |