diff options
author | Jonas Diemer <jonasdiemer@gmail.com> | 2022-08-17 08:28:11 +0000 |
---|---|---|
committer | Jonas Diemer <jonasdiemer@gmail.com> | 2022-09-18 18:25:37 +0000 |
commit | 5404e4fcb513bd8bf355e730aa37546b16164cad (patch) | |
tree | 8b0e0d4a0b23cf598d84423cabc1d6bca38345ec /src/file_upload.rs | |
parent | Use argument -u instead of --allowed-upload-dir (diff) | |
download | miniserve-5404e4fcb513bd8bf355e730aa37546b16164cad.tar.gz miniserve-5404e4fcb513bd8bf355e730aa37546b16164cad.zip |
sanitize allowed upload paths for cases like ./dir
Diffstat (limited to 'src/file_upload.rs')
-rw-r--r-- | src/file_upload.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/file_upload.rs b/src/file_upload.rs index c6e7ac6..4d4f225 100644 --- a/src/file_upload.rs +++ b/src/file_upload.rs @@ -218,7 +218,7 @@ pub async fn upload_file( /// and optionally prevent traversing hidden directories. /// /// See the unit tests tests::test_sanitize_path* for examples -fn sanitize_path(path: &Path, traverse_hidden: bool) -> Option<PathBuf> { +pub fn sanitize_path(path: &Path, traverse_hidden: bool) -> Option<PathBuf> { let mut buf = PathBuf::new(); for comp in path.components() { |