From 255172d84183018180537b48baecefcb7fd1efd3 Mon Sep 17 00:00:00 2001 From: Paul Z Date: Thu, 20 Apr 2023 14:45:23 +0200 Subject: [PATCH] made content_type optional --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 65fa91b..6d53dbc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -135,7 +135,7 @@ async fn post_item( Path(id): Path, Query(params): Query, State(app_state): State, - TypedHeader(content_type): TypedHeader, + content_type: Option>, mut stream: BodyStream, ) -> HandlerResult { let id = sanitize_id(id); @@ -171,7 +171,7 @@ async fn post_item( data_file.write_all(&buf).await.unwrap(); } - metadata.mimetype = Some(content_type.to_string()); + metadata.mimetype = content_type.map(|x| x.0.to_string()); metadata.ttl = Some(expires_at); metadata.to_file(&app_state.path, &id).await.unwrap();