diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/archive.rs | 9 | ||||
-rw-r--r-- | src/errors.rs | 2 | ||||
-rw-r--r-- | src/file_op.rs | 4 | ||||
-rw-r--r-- | src/listing.rs | 1 |
4 files changed, 3 insertions, 13 deletions
diff --git a/src/archive.rs b/src/archive.rs index bfae66e..e52fc49 100644 --- a/src/archive.rs +++ b/src/archive.rs @@ -2,7 +2,6 @@ use std::fs::File; use std::io::{Cursor, Read, Write}; use std::path::{Path, PathBuf}; -use actix_web::http::header::ContentEncoding; use libflate::gzip::Encoder; use serde::Deserialize; use strum::{Display, EnumIter, EnumString}; @@ -45,14 +44,6 @@ impl ArchiveMethod { .to_string() } - pub fn content_encoding(self) -> ContentEncoding { - match self { - ArchiveMethod::TarGz => ContentEncoding::Gzip, - ArchiveMethod::Tar => ContentEncoding::Identity, - ArchiveMethod::Zip => ContentEncoding::Identity, - } - } - pub fn is_enabled(self, tar_enabled: bool, tar_gz_enabled: bool, zip_enabled: bool) -> bool { match self { ArchiveMethod::TarGz => tar_gz_enabled, diff --git a/src/errors.rs b/src/errors.rs index 6875b90..80d9b9e 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -18,7 +18,7 @@ pub enum ContextualError { /// Might occur during file upload, when processing the multipart request fails #[error("Failed to process multipart request\ncaused by: {0}")] - MultipartError(actix_multipart::MultipartError), + MultipartError(String), /// Might occur during file upload #[error("File already exists, and the overwrite_files option has not been set")] diff --git a/src/file_op.rs b/src/file_op.rs index d9786c4..590ab25 100644 --- a/src/file_op.rs +++ b/src/file_op.rs @@ -32,7 +32,7 @@ async fn save_file( })?; let (_, written_len) = field - .map_err(ContextualError::MultipartError) + .map_err(|x| ContextualError::MultipartError(x.to_string())) .try_fold((file, 0u64), |(mut file, written_len), bytes| async move { file.write_all(bytes.as_ref()) .map_err(|e| ContextualError::IoError("Failed to write to file".to_string(), e))?; @@ -209,7 +209,7 @@ pub async fn upload_file( }?; actix_multipart::Multipart::new(req.headers(), payload) - .map_err(ContextualError::MultipartError) + .map_err(|x| ContextualError::MultipartError(x.to_string())) .and_then(|field| { handle_multipart( field, diff --git a/src/listing.rs b/src/listing.rs index 66f77e1..6e75b0e 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -368,7 +368,6 @@ pub fn directory_listing( req.clone(), HttpResponse::Ok() .content_type(archive_method.content_type()) - .append_header(archive_method.content_encoding()) .append_header(("Content-Transfer-Encoding", "binary")) .append_header(( "Content-Disposition", |