mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
use OwnedMxcUri in media service
Not using `MxcData` because it borrows it's fields, and so we wouldn't be able to return an owned `MxcData` from functions that read the db.
This commit is contained in:
parent
e2cba15ed2
commit
7672cc8473
5 changed files with 25 additions and 23 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use std::io::Cursor;
|
||||
|
||||
use image::imageops::FilterType;
|
||||
use ruma::http_headers::ContentDisposition;
|
||||
use ruma::{http_headers::ContentDisposition, OwnedMxcUri};
|
||||
use tokio::{
|
||||
fs::File,
|
||||
io::{AsyncReadExt, AsyncWriteExt},
|
||||
|
|
@ -46,7 +46,7 @@ impl Service {
|
|||
#[tracing::instrument(skip(self, file))]
|
||||
pub(crate) async fn create(
|
||||
&self,
|
||||
mxc: String,
|
||||
mxc: OwnedMxcUri,
|
||||
content_disposition: Option<&ContentDisposition>,
|
||||
content_type: Option<String>,
|
||||
file: &[u8],
|
||||
|
|
@ -69,7 +69,7 @@ impl Service {
|
|||
#[tracing::instrument(skip(self, file))]
|
||||
pub(crate) async fn upload_thumbnail(
|
||||
&self,
|
||||
mxc: String,
|
||||
mxc: OwnedMxcUri,
|
||||
content_disposition: Option<String>,
|
||||
content_type: Option<String>,
|
||||
width: u32,
|
||||
|
|
@ -93,7 +93,7 @@ impl Service {
|
|||
#[tracing::instrument(skip(self))]
|
||||
pub(crate) async fn get(
|
||||
&self,
|
||||
mxc: String,
|
||||
mxc: OwnedMxcUri,
|
||||
) -> Result<Option<(FileMeta, Vec<u8>)>> {
|
||||
if let Ok((meta, key)) = self.db.search_file_metadata(mxc, 0, 0) {
|
||||
let path = services().globals.get_media_file(&key);
|
||||
|
|
@ -224,7 +224,7 @@ impl Service {
|
|||
#[tracing::instrument(skip(self))]
|
||||
pub(crate) async fn get_thumbnail(
|
||||
&self,
|
||||
mxc: String,
|
||||
mxc: OwnedMxcUri,
|
||||
width: u32,
|
||||
height: u32,
|
||||
) -> Result<Option<(FileMeta, Vec<u8>)>> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue