From 99b93b4e7d2b135d14531f1e0417f8b15eb65f49 Mon Sep 17 00:00:00 2001 From: xenofem Date: Sun, 1 May 2022 02:22:03 -0400 Subject: [PATCH] just unwrap on datetime formatting, it should never be an issue and there's no point having an error ready to pass back to the client --- src/upload.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/upload.rs b/src/upload.rs index 9357648..5b1bd59 100644 --- a/src/upload.rs +++ b/src/upload.rs @@ -22,8 +22,6 @@ enum Error { Parse(#[from] serde_json::Error), #[error("Error writing to stored file")] Storage(#[from] std::io::Error), - #[error("Time formatting error")] - TimeFormat(#[from] time::error::Format), #[error("Duplicate filename could not be deduplicated")] DuplicateFilename, #[error("This message type was not expected at this stage")] @@ -45,8 +43,7 @@ enum Error { impl Error { fn close_code(&self) -> CloseCode { match self { - Self::Storage(_) - | Self::TimeFormat(_) => CloseCode::Error, + Self::Storage(_) => CloseCode::Error, Self::Parse(_) | Self::UnexpectedMessageType | Self::ClosedEarly(_) @@ -245,7 +242,7 @@ impl Uploader { let zip_writer = super::zip::ZipGenerator::new(files, writer); let size = zip_writer.total_size(); let download_filename = - super::APP_NAME.to_owned() + &now.format(FILENAME_DATE_FORMAT)? + ".zip"; + super::APP_NAME.to_owned() + &now.format(FILENAME_DATE_FORMAT).unwrap() + ".zip"; ( Box::new(zip_writer), download_filename,