forked from mirror/grapevine
Make MxcData Copy
This commit is contained in:
parent
58c104f6c8
commit
391fc2e51a
2 changed files with 7 additions and 7 deletions
|
@ -257,7 +257,7 @@ async fn get_redirected_content(
|
|||
|
||||
#[tracing::instrument(skip_all)]
|
||||
async fn get_remote_content_via_federation_api(
|
||||
mxc: &MxcData<'_>,
|
||||
mxc: MxcData<'_>,
|
||||
) -> Result<RemoteResponse, Error> {
|
||||
let authenticated_media_fed::get_content::v1::Response {
|
||||
metadata,
|
||||
|
@ -293,7 +293,7 @@ async fn get_remote_content_via_federation_api(
|
|||
#[allow(deprecated)] // unauthenticated media
|
||||
#[tracing::instrument(skip_all)]
|
||||
async fn get_remote_content_via_legacy_api(
|
||||
mxc: &MxcData<'_>,
|
||||
mxc: MxcData<'_>,
|
||||
) -> Result<RemoteResponse, Error> {
|
||||
let content_response = services()
|
||||
.sending
|
||||
|
@ -321,7 +321,7 @@ async fn get_remote_content_via_legacy_api(
|
|||
|
||||
#[tracing::instrument]
|
||||
pub(crate) async fn get_remote_content(
|
||||
mxc: &MxcData<'_>,
|
||||
mxc: MxcData<'_>,
|
||||
) -> Result<RemoteResponse, Error> {
|
||||
let fed_result = get_remote_content_via_federation_api(mxc).await;
|
||||
|
||||
|
@ -468,7 +468,7 @@ async fn get_content_route_ruma(
|
|||
} else if &*body.server_name != services().globals.server_name()
|
||||
&& allow_remote == AllowRemote::Yes
|
||||
{
|
||||
let remote_response = get_remote_content(&mxc).await?;
|
||||
let remote_response = get_remote_content(mxc).await?;
|
||||
Ok(authenticated_media_client::get_content::v1::Response {
|
||||
file: remote_response.content.file,
|
||||
content_disposition: Some(content_disposition_for(
|
||||
|
@ -594,7 +594,7 @@ async fn get_content_as_filename_route_ruma(
|
|||
} else if &*body.server_name != services().globals.server_name()
|
||||
&& allow_remote == AllowRemote::Yes
|
||||
{
|
||||
let remote_response = get_remote_content(&mxc).await?;
|
||||
let remote_response = get_remote_content(mxc).await?;
|
||||
|
||||
Ok(authenticated_media_client::get_content_as_filename::v1::Response {
|
||||
content_disposition: Some(content_disposition_for(
|
||||
|
@ -893,7 +893,7 @@ async fn get_content_thumbnail_route_ruma(
|
|||
),
|
||||
}
|
||||
|
||||
get_remote_content(&mxc).await?;
|
||||
get_remote_content(mxc).await?;
|
||||
|
||||
if let Some((
|
||||
FileMeta {
|
||||
|
|
|
@ -256,7 +256,7 @@ pub(crate) fn dbg_truncate_str(s: &str, mut max_len: usize) -> Cow<'_, str> {
|
|||
}
|
||||
|
||||
/// Data that makes up an `mxc://` URL.
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub(crate) struct MxcData<'a> {
|
||||
pub(crate) server_name: &'a ruma::ServerName,
|
||||
pub(crate) media_id: &'a str,
|
||||
|
|
Loading…
Reference in a new issue