Skip to content

Commit ecf4434

Browse files
zecakehbnjbvr
authored andcommitted
fix(client): Do not use the encrypted original file's content type as the encrypted thumbnail's content type
Signed-off-by: Kévin Commaille <[email protected]>
1 parent cc8bc05 commit ecf4434

File tree

1 file changed

+2
-4
lines changed
  • crates/matrix-sdk/src/encryption

1 file changed

+2
-4
lines changed

crates/matrix-sdk/src/encryption/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,7 @@ impl Client {
460460
thumbnail: Option<Thumbnail>,
461461
send_progress: SharedObservable<TransmissionProgress>,
462462
) -> Result<(MediaSource, Option<(MediaSource, Box<ThumbnailInfo>)>)> {
463-
let upload_thumbnail =
464-
self.upload_encrypted_thumbnail(thumbnail, content_type, send_progress.clone());
463+
let upload_thumbnail = self.upload_encrypted_thumbnail(thumbnail, send_progress.clone());
465464

466465
let upload_attachment = async {
467466
let mut cursor = Cursor::new(data);
@@ -480,7 +479,6 @@ impl Client {
480479
async fn upload_encrypted_thumbnail(
481480
&self,
482481
thumbnail: Option<Thumbnail>,
483-
content_type: &mime::Mime,
484482
send_progress: SharedObservable<TransmissionProgress>,
485483
) -> Result<Option<(MediaSource, Box<ThumbnailInfo>)>> {
486484
let Some(thumbnail) = thumbnail else {
@@ -490,7 +488,7 @@ impl Client {
490488
let mut cursor = Cursor::new(thumbnail.data);
491489

492490
let file = self
493-
.upload_encrypted_file(content_type, &mut cursor)
491+
.upload_encrypted_file(&thumbnail.content_type, &mut cursor)
494492
.with_send_progress_observable(send_progress)
495493
.await?;
496494

0 commit comments

Comments
 (0)