add missing Cow header in federation authenticated media
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
a0cc9a80dd
commit
89cee2d2d9
@ -2,6 +2,8 @@
|
|||||||
//!
|
//!
|
||||||
//! [MSC3916]: https://github.com/matrix-org/matrix-spec-proposals/pull/3916
|
//! [MSC3916]: https://github.com/matrix-org/matrix-spec-proposals/pull/3916
|
||||||
|
|
||||||
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use ruma_common::http_headers::ContentDisposition;
|
use ruma_common::http_headers::ContentDisposition;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
@ -46,7 +48,7 @@ pub struct Content {
|
|||||||
pub file: Vec<u8>,
|
pub file: Vec<u8>,
|
||||||
|
|
||||||
/// The content type of the file that was previously uploaded.
|
/// The content type of the file that was previously uploaded.
|
||||||
pub content_type: Option<String>,
|
pub content_type: Option<Cow<'static, str>>,
|
||||||
|
|
||||||
/// The value of the `Content-Disposition` HTTP header, possibly containing the name of the
|
/// The value of the `Content-Disposition` HTTP header, possibly containing the name of the
|
||||||
/// file that was previously uploaded.
|
/// file that was previously uploaded.
|
||||||
@ -234,7 +236,11 @@ fn try_from_multipart_mixed_response<T: AsRef<[u8]>>(
|
|||||||
let content = if let Some(location) = location {
|
let content = if let Some(location) = location {
|
||||||
FileOrLocation::Location(location)
|
FileOrLocation::Location(location)
|
||||||
} else {
|
} 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))
|
Ok((metadata, content))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user