Revert "add missing corp/cache-control headers to authenticated media"

This reverts commit 9d25b0d5c27dbcc62a70fbaacb80632bf6bc9ebc.
This commit is contained in:
strawberry 2024-08-14 01:46:10 -04:00
parent 3174097e35
commit 959048c0c4
3 changed files with 7 additions and 78 deletions

View File

@ -9,14 +9,12 @@ pub mod v1 {
use std::{borrow::Cow, time::Duration};
use http::header::{CACHE_CONTROL, CONTENT_DISPOSITION, CONTENT_TYPE};
use http::header::{CONTENT_DISPOSITION, CONTENT_TYPE};
use ruma_common::{
api::{request, response, Metadata},
metadata, IdParseError, MxcUri, OwnedServerName,
};
use crate::http_headers::CROSS_ORIGIN_RESOURCE_POLICY;
const METADATA: Metadata = metadata! {
method: GET,
rate_limited: true,
@ -70,22 +68,6 @@ pub mod v1 {
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Syntax
#[ruma_api(header = CONTENT_DISPOSITION)]
pub content_disposition: Option<Cow<'static, str>>,
/// The value of the `Cross-Origin-Resource-Policy` HTTP header.
///
/// See [MDN] for the syntax.
///
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy#syntax
#[ruma_api(header = CROSS_ORIGIN_RESOURCE_POLICY)]
pub cross_origin_resource_policy: Option<Cow<'static, str>>,
/// The value of the `Cache-Control` HTTP header.
///
/// See [MDN] for the syntax.
///
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#syntax
#[ruma_api(header = CACHE_CONTROL)]
pub cache_control: Option<Cow<'static, str>>,
}
impl Request {
@ -105,13 +87,7 @@ pub mod v1 {
impl Response {
/// Creates a new `Response` with the given file contents.
pub fn new(file: Vec<u8>) -> Self {
Self {
file,
content_type: None,
content_disposition: None,
cross_origin_resource_policy: None,
cache_control: None,
}
Self { file, content_type: None, content_disposition: None }
}
}
}

View File

@ -9,14 +9,12 @@ pub mod v1 {
use std::{borrow::Cow, time::Duration};
use http::header::{CACHE_CONTROL, CONTENT_DISPOSITION, CONTENT_TYPE};
use http::header::{CONTENT_DISPOSITION, CONTENT_TYPE};
use ruma_common::{
api::{request, response, Metadata},
metadata, IdParseError, MxcUri, OwnedServerName,
};
use crate::http_headers::CROSS_ORIGIN_RESOURCE_POLICY;
const METADATA: Metadata = metadata! {
method: GET,
rate_limited: true,
@ -74,22 +72,6 @@ pub mod v1 {
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Syntax
#[ruma_api(header = CONTENT_DISPOSITION)]
pub content_disposition: Option<Cow<'static, str>>,
/// The value of the `Cross-Origin-Resource-Policy` HTTP header.
///
/// See [MDN] for the syntax.
///
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy#syntax
#[ruma_api(header = CROSS_ORIGIN_RESOURCE_POLICY)]
pub cross_origin_resource_policy: Option<Cow<'static, str>>,
/// The value of the `Cache-Control` HTTP header.
///
/// See [MDN] for the syntax.
///
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#syntax
#[ruma_api(header = CACHE_CONTROL)]
pub cache_control: Option<Cow<'static, str>>,
}
impl Request {
@ -114,13 +96,7 @@ pub mod v1 {
impl Response {
/// Creates a new `Response` with the given file.
pub fn new(file: Vec<u8>) -> Self {
Self {
file,
content_type: None,
content_disposition: None,
cross_origin_resource_policy: None,
cache_control: None,
}
Self { file, content_type: None, content_disposition: None }
}
}
}

View File

@ -9,16 +9,14 @@ pub mod v1 {
use std::{borrow::Cow, time::Duration};
use http::header::{CACHE_CONTROL, CONTENT_TYPE};
use http::header::CONTENT_TYPE;
use js_int::UInt;
use ruma_common::{
api::{request, response, Metadata},
metadata, IdParseError, MxcUri, OwnedServerName,
};
use crate::{
http_headers::CROSS_ORIGIN_RESOURCE_POLICY, media::get_content_thumbnail::v3::Method,
};
use crate::media::get_content_thumbnail::v3::Method;
const METADATA: Metadata = metadata! {
method: GET,
@ -90,22 +88,6 @@ pub mod v1 {
/// The content type of the thumbnail.
#[ruma_api(header = CONTENT_TYPE)]
pub content_type: Option<Cow<'static, str>>,
/// The value of the `Cross-Origin-Resource-Policy` HTTP header.
///
/// See [MDN] for the syntax.
///
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy#syntax
#[ruma_api(header = CROSS_ORIGIN_RESOURCE_POLICY)]
pub cross_origin_resource_policy: Option<Cow<'static, str>>,
/// The value of the `Cache-Control` HTTP header.
///
/// See [MDN] for the syntax.
///
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#syntax
#[ruma_api(header = CACHE_CONTROL)]
pub cache_control: Option<Cow<'static, str>>,
}
impl Request {
@ -140,12 +122,7 @@ pub mod v1 {
impl Response {
/// Creates a new `Response` with the given thumbnail.
pub fn new(file: Vec<u8>) -> Self {
Self {
file,
content_type: None,
cross_origin_resource_policy: None,
cache_control: None,
}
Self { file, content_type: None }
}
}
}