diff options
author | Jonas Diemer <jonasdiemer@gmail.com> | 2022-09-19 11:06:17 +0000 |
---|---|---|
committer | Jonas Diemer <jonasdiemer@gmail.com> | 2022-09-19 11:06:17 +0000 |
commit | 6577af2b8d802ad213968e4b7c9f2823c1ab52dc (patch) | |
tree | 9550db92fafa937ad9699ee252b3eae3838f241b /src/config.rs | |
parent | Switched to using Path in test to handle windows platform. (diff) | |
download | miniserve-6577af2b8d802ad213968e4b7c9f2823c1ab52dc.tar.gz miniserve-6577af2b8d802ad213968e4b7c9f2823c1ab52dc.zip |
Changed handling of allowed path to fix Windows
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 10 |
1 files changed, 8 insertions, 2 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, |