mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(permissions): add information about import() API request (#17149)
This commit changes permission prompt to show that "import()" API is requesting permissions. Given "dynamic_import.js" like so: ``` import("https://deno.land/std@0.170.0/version.ts"); ``` Before: ``` deno run dynamic_import.js ⚠️ ┌ Deno requests net access to "deno.land". ├ Run again with --allow-net to bypass this prompt. └ Allow? [y/n] (y = yes, allow; n = no, deny) > ``` After: ``` deno run dynamic_import.js ⚠️ ┌ Deno requests net access to "deno.land". ├ Requested by `import()` API ├ Run again with --allow-net to bypass this prompt. └ Allow? [y/n] (y = yes, allow; n = no, deny) > ```
This commit is contained in:
parent
6a47ffa4d3
commit
4258e06f87
1 changed files with 2 additions and 2 deletions
|
@ -1601,7 +1601,7 @@ impl Permissions {
|
|||
) -> Result<(), AnyError> {
|
||||
match specifier.scheme() {
|
||||
"file" => match specifier.to_file_path() {
|
||||
Ok(path) => self.read.check(&path, None),
|
||||
Ok(path) => self.read.check(&path, Some("import()")),
|
||||
Err(_) => Err(uri_error(format!(
|
||||
"Invalid file path.\n Specifier: {}",
|
||||
specifier
|
||||
|
@ -1609,7 +1609,7 @@ impl Permissions {
|
|||
},
|
||||
"data" => Ok(()),
|
||||
"blob" => Ok(()),
|
||||
_ => self.net.check_url(specifier, None),
|
||||
_ => self.net.check_url(specifier, Some("import()")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue