made content_type optional
This commit is contained in:
parent
1ff78e414f
commit
255172d841
1 changed files with 2 additions and 2 deletions
|
@ -135,7 +135,7 @@ async fn post_item(
|
||||||
Path(id): Path<String>,
|
Path(id): Path<String>,
|
||||||
Query(params): Query<PostQuery>,
|
Query(params): Query<PostQuery>,
|
||||||
State(app_state): State<AppState>,
|
State(app_state): State<AppState>,
|
||||||
TypedHeader(content_type): TypedHeader<ContentType>,
|
content_type: Option<TypedHeader<ContentType>>,
|
||||||
mut stream: BodyStream,
|
mut stream: BodyStream,
|
||||||
) -> HandlerResult<impl IntoResponse> {
|
) -> HandlerResult<impl IntoResponse> {
|
||||||
let id = sanitize_id(id);
|
let id = sanitize_id(id);
|
||||||
|
@ -171,7 +171,7 @@ async fn post_item(
|
||||||
data_file.write_all(&buf).await.unwrap();
|
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.ttl = Some(expires_at);
|
||||||
|
|
||||||
metadata.to_file(&app_state.path, &id).await.unwrap();
|
metadata.to_file(&app_state.path, &id).await.unwrap();
|
||||||
|
|
Loading…
Reference in a new issue