From 89cee2d2d9f3776cb0a94fcea04fca456ed8a064 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 27 Aug 2024 02:38:30 +0000 Subject: [PATCH] add missing Cow header in federation authenticated media Signed-off-by: Jason Volk --- crates/ruma-federation-api/src/authenticated_media.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/ruma-federation-api/src/authenticated_media.rs b/crates/ruma-federation-api/src/authenticated_media.rs index 135d3424..03bb753e 100644 --- a/crates/ruma-federation-api/src/authenticated_media.rs +++ b/crates/ruma-federation-api/src/authenticated_media.rs @@ -2,6 +2,8 @@ //! //! [MSC3916]: https://github.com/matrix-org/matrix-spec-proposals/pull/3916 +use std::borrow::Cow; + use ruma_common::http_headers::ContentDisposition; use serde::{Deserialize, Serialize}; @@ -46,7 +48,7 @@ pub struct Content { pub file: Vec, /// The content type of the file that was previously uploaded. - pub content_type: Option, + pub content_type: Option>, /// The value of the `Content-Disposition` HTTP header, possibly containing the name of the /// file that was previously uploaded. @@ -234,7 +236,11 @@ fn try_from_multipart_mixed_response>( let content = if let Some(location) = location { FileOrLocation::Location(location) } else { - FileOrLocation::File(Content { file: file.to_owned(), content_type, content_disposition }) + FileOrLocation::File(Content { + file: file.to_owned(), + content_type: content_type.map(Into::into), + content_disposition, + }) }; Ok((metadata, content))