Skip to content

Commit

Permalink
feat(media): don't clone the data when uploading an encrypted media
Browse files Browse the repository at this point in the history
  • Loading branch information
bnjbvr committed Oct 22, 2024
1 parent 92de0e2 commit 53b40c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/matrix-sdk/src/encryption/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ impl Client {
pub(crate) async fn upload_encrypted_media_and_thumbnail(
&self,
content_type: &mime::Mime,
data: Vec<u8>,
data: &[u8],
thumbnail: Option<Thumbnail>,
send_progress: SharedObservable<TransmissionProgress>,
) -> Result<(MediaSource, Option<MediaSource>, Option<Box<ThumbnailInfo>>)> {
Expand Down
7 changes: 1 addition & 6 deletions crates/matrix-sdk/src/room/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1936,12 +1936,7 @@ impl Room {
#[cfg(feature = "e2e-encryption")]
let (media_source, thumbnail_source, thumbnail_info) = if self.is_encrypted().await? {
self.client
.upload_encrypted_media_and_thumbnail(
content_type,
data.clone(),
thumbnail,
send_progress,
)
.upload_encrypted_media_and_thumbnail(content_type, &data, thumbnail, send_progress)
.await?
} else {
self.client
Expand Down

0 comments on commit 53b40c9

Please sign in to comment.