Remove encryption logic as it is handled by matrix-sdk e2e-encryption feature directly
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -4,11 +4,9 @@ use crate::utils::crypt_utils::sha512;
|
||||
use actix_web::dev::Payload;
|
||||
use actix_web::http::header;
|
||||
use actix_web::{FromRequest, HttpRequest, HttpResponse, web};
|
||||
use matrix_sdk::crypto::{AttachmentDecryptor, MediaEncryptionInfo};
|
||||
use matrix_sdk::media::{MediaFormat, MediaRequestParameters, MediaThumbnailSettings};
|
||||
use matrix_sdk::ruma::events::room::MediaSource;
|
||||
use matrix_sdk::ruma::{OwnedMxcUri, UInt};
|
||||
use std::io::{Cursor, Read};
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
pub struct MediaMXCInPath {
|
||||
@@ -54,21 +52,6 @@ pub async fn serve_media(req: HttpRequest, source: MediaSource, thumbnail: bool)
|
||||
)
|
||||
.await?;
|
||||
|
||||
// Decrypt file if needed
|
||||
let media = if let MediaSource::Encrypted(file) = source {
|
||||
let mut cursor = Cursor::new(media);
|
||||
let mut decryptor =
|
||||
AttachmentDecryptor::new(&mut cursor, MediaEncryptionInfo::from(*file))?;
|
||||
|
||||
let mut decrypted_data = Vec::new();
|
||||
|
||||
decryptor.read_to_end(&mut decrypted_data)?;
|
||||
|
||||
decrypted_data
|
||||
} else {
|
||||
media
|
||||
};
|
||||
|
||||
let digest = sha512(&media);
|
||||
|
||||
let mime_type = infer::get(&media).map(|x| x.mime_type());
|
||||
|
||||
Reference in New Issue
Block a user