Merge pull request #17 from ben1009/feat/support-file-urls
feat: support file:// URL scheme for local HTML testing
This commit is contained in:
2 files changed
+51
-4
No files matched your search
@@ -551,13 +551,17 @@ fn glob_match(pattern: &str, url: &str) -> bool {
|
||||
|
||||
fn validate_fetch_url(url: &url::Url) -> Result<(), String> {
|
||||
let scheme = url.scheme();
|
||||
if scheme != "http" && scheme != "https" {
|
||||
if scheme != "http" && scheme != "https" && scheme != "file" {
|
||||
return Err(format!(
|
||||
"Forbidden URL scheme '{}' - only http and https are allowed",
|
||||
"Forbidden URL scheme '{}' - only http, https, and file are allowed",
|
||||
scheme
|
||||
));
|
||||
}
|
||||
|
||||
if scheme == "file" {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let Some(host) = url.host() {
|
||||
match host {
|
||||
url::Host::Ipv4(ip) => {
|
||||
|
||||
Reference in new issue
Block a user