add missing ContentDisposition header; fix non-upstreamed ContentDisposition strong type

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-08-15 01:07:28 +00:00
parent 11cbd52af1
commit 6e5e96cba3
2 changed files with 14 additions and 2 deletions

View File

@ -9,10 +9,11 @@ pub mod v1 {
use std::time::Duration; use std::time::Duration;
use http::header::{CACHE_CONTROL, CONTENT_TYPE}; use http::header::{CACHE_CONTROL, CONTENT_DISPOSITION, CONTENT_TYPE};
use js_int::UInt; use js_int::UInt;
use ruma_common::{ use ruma_common::{
api::{request, response, Metadata}, api::{request, response, Metadata},
http_headers::ContentDisposition,
media::Method, media::Method,
metadata, IdParseError, MxcUri, OwnedServerName, metadata, IdParseError, MxcUri, OwnedServerName,
}; };
@ -109,6 +110,15 @@ pub mod v1 {
/// TODO: make this use Cow static str's /// TODO: make this use Cow static str's
#[ruma_api(header = CACHE_CONTROL)] #[ruma_api(header = CACHE_CONTROL)]
pub cache_control: Option<String>, pub cache_control: Option<String>,
/// The value of the `Content-Disposition` HTTP header, possibly containing the name of the
/// file that was previously uploaded.
///
/// See [MDN] for the syntax.
///
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Syntax
#[ruma_api(header = CONTENT_DISPOSITION)]
pub content_disposition: Option<ContentDisposition>,
} }
impl Request { impl Request {
@ -148,6 +158,7 @@ pub mod v1 {
content_type: None, content_type: None,
cross_origin_resource_policy: None, cross_origin_resource_policy: None,
cache_control: None, cache_control: None,
content_disposition: None,
} }
} }
} }

View File

@ -14,6 +14,7 @@ pub mod v3 {
pub use ruma_common::media::Method; pub use ruma_common::media::Method;
use ruma_common::{ use ruma_common::{
api::{request, response, Metadata}, api::{request, response, Metadata},
http_headers::ContentDisposition,
metadata, IdParseError, MxcUri, OwnedServerName, metadata, IdParseError, MxcUri, OwnedServerName,
}; };
@ -136,7 +137,7 @@ pub mod v3 {
/// ///
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Syntax /// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Syntax
#[ruma_api(header = CONTENT_DISPOSITION)] #[ruma_api(header = CONTENT_DISPOSITION)]
pub content_disposition: Option<String>, pub content_disposition: Option<ContentDisposition>,
} }
#[allow(deprecated)] #[allow(deprecated)]