fix: Empty content dispositions could create problems

This commit is contained in:
Timo Kösters 2024-09-25 09:06:43 +02:00
parent fea85b0894
commit 65fe6b0ab5
No known key found for this signature in database
GPG key ID: 0B25E636FBA7E4CB

View file

@ -63,9 +63,9 @@ impl service::media::Data for KeyValueDatabase {
.next() .next()
.ok_or_else(|| Error::bad_database("Media ID in db is invalid."))?; .ok_or_else(|| Error::bad_database("Media ID in db is invalid."))?;
let content_disposition = content_disposition_bytes let content_disposition = content_disposition_bytes.try_into().unwrap_or_else(|_| {
.try_into() ContentDisposition::new(ruma::http_headers::ContentDispositionType::Inline)
.map_err(|_| Error::bad_database("Content Disposition in mediaid_file is invalid."))?; });
Ok((content_disposition, content_type, key)) Ok((content_disposition, content_type, key))
} }
} }