diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.rs | 10 | ||||
-rw-r--r-- | src/renderer.rs | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/config.rs b/src/config.rs index 69ef0c4..cef7cda 100644 --- a/src/config.rs +++ b/src/config.rs @@ -89,7 +89,7 @@ pub struct MiniserveConfig { pub file_upload: bool, /// List of allowed upload directories - pub allowed_upload_dir: Vec<PathBuf>, + pub allowed_upload_dir: Vec<String>, /// HTML accept attribute value pub uploadable_media_type: Option<String>, @@ -256,7 +256,13 @@ impl MiniserveConfig { .allowed_upload_dir .unwrap_or_default() .iter() - .map(|x| sanitize_path(x, false).unwrap()) + .map(|x| { + sanitize_path(x, false) + .unwrap() + .to_str() + .unwrap() + .replace(r"\", "/") + }) .collect(), uploadable_media_type, tar_enabled: args.enable_tar, diff --git a/src/renderer.rs b/src/renderer.rs index b98a595..38d2617 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -44,7 +44,7 @@ pub fn page( || conf .allowed_upload_dir .iter() - .any(|x| encoded_dir.starts_with(&format!("/{}", x.display()))); + .any(|x| encoded_dir.starts_with(&format!("/{}", x))); html! { (DOCTYPE) |