diff options
author | Sven-Hendrik Haase <svenstaro@gmail.com> | 2020-05-14 03:47:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-14 03:47:54 +0000 |
commit | e1ed1a807ca65cea8b19bf4d12df12aa45c9826a (patch) | |
tree | 63e9c44cff4e896a948111ed6330270cd3101111 /src/listing.rs | |
parent | Merge pull request #301 from svenstaro/dependabot/cargo/serde-1.0.110 (diff) | |
parent | rename variables correctly (diff) | |
download | miniserve-e1ed1a807ca65cea8b19bf4d12df12aa45c9826a.tar.gz miniserve-e1ed1a807ca65cea8b19bf4d12df12aa45c9826a.zip |
Merge pull request #297 from marawan31/add-zip-download
Add zip download functionality for windows users
Diffstat (limited to 'src/listing.rs')
-rw-r--r-- | src/listing.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/listing.rs b/src/listing.rs index d28824c..45b3732 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -136,7 +136,8 @@ pub fn directory_listing<S>( random_route: Option<String>, default_color_scheme: ColorScheme, upload_route: String, - archives_enabled: bool, + tar_enabled: bool, + zip_enabled: bool, ) -> Result<HttpResponse, io::Error> { let serve_path = req.path(); @@ -250,7 +251,7 @@ pub fn directory_listing<S>( let color_scheme = query_params.theme.unwrap_or(default_color_scheme); if let Some(compression_method) = query_params.download { - if !archives_enabled { + if !compression_method.is_enabled(tar_enabled, zip_enabled) { return Ok(HttpResponse::Forbidden() .content_type("text/html; charset=utf-8") .body( @@ -332,7 +333,8 @@ pub fn directory_listing<S>( file_upload, &upload_route, ¤t_dir.display().to_string(), - archives_enabled, + tar_enabled, + zip_enabled, ) .into_string(), )) |