Merge pull request #17 from ben1009/feat/support-file-urls

feat: support file:// URL scheme for local HTML testing
This commit is contained in:
h4ckf0r0day authored and GitHub committed 2026-04-25 12:36:57 +02:00
commit 00ee2db9cb
2 files changed
+51 -4

No files matched your search

+6 -2
View File
@@ -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) => {