From 65fe6b0ab5968e4b6c4fdb1a20070ddd4def08ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20K=C3=B6sters?= Date: Wed, 25 Sep 2024 09:06:43 +0200 Subject: [PATCH] fix: Empty content dispositions could create problems --- src/database/key_value/media.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/database/key_value/media.rs b/src/database/key_value/media.rs index 52a8e79e..99df0097 100644 --- a/src/database/key_value/media.rs +++ b/src/database/key_value/media.rs @@ -63,9 +63,9 @@ impl service::media::Data for KeyValueDatabase { .next() .ok_or_else(|| Error::bad_database("Media ID in db is invalid."))?; - let content_disposition = content_disposition_bytes - .try_into() - .map_err(|_| Error::bad_database("Content Disposition in mediaid_file is invalid."))?; + let content_disposition = content_disposition_bytes.try_into().unwrap_or_else(|_| { + ContentDisposition::new(ruma::http_headers::ContentDispositionType::Inline) + }); Ok((content_disposition, content_type, key)) } }