diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesFlowNode.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesFlowNode.kt index 12df0bc0bf..08b485b1e7 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesFlowNode.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesFlowNode.kt @@ -324,7 +324,7 @@ class MessagesFlowNode @AssistedInject constructor( is TimelineItemImageContent -> { val navTarget = NavTarget.MediaViewer( mediaInfo = MediaInfo( - name = event.content.body, + name = event.content.filename ?: event.content.body, mimeType = event.content.mimeType, formattedFileSize = event.content.formattedFileSize, fileExtension = event.content.fileExtension @@ -358,7 +358,7 @@ class MessagesFlowNode @AssistedInject constructor( is TimelineItemVideoContent -> { val navTarget = NavTarget.MediaViewer( mediaInfo = MediaInfo( - name = event.content.body, + name = event.content.filename ?: event.content.body, mimeType = event.content.mimeType, formattedFileSize = event.content.formattedFileSize, fileExtension = event.content.fileExtension diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemImageView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemImageView.kt index af401dc56a..9f9222f458 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemImageView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemImageView.kt @@ -81,7 +81,13 @@ fun TimelineItemImageView( modifier = Modifier .fillMaxWidth() .then(if (isLoaded) Modifier.background(Color.White) else Modifier), - model = MediaRequestData(content.preferredMediaSource, MediaRequestData.Kind.File(content.body, content.mimeType)), + model = MediaRequestData( + source = content.preferredMediaSource, + kind = MediaRequestData.Kind.File( + body = content.filename ?: content.body, + mimeType = content.mimeType, + ), + ), contentScale = ContentScale.Fit, alignment = Alignment.Center, contentDescription = description, diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemVideoView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemVideoView.kt index 31cb5f1607..7324d3368b 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemVideoView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemVideoView.kt @@ -88,7 +88,13 @@ fun TimelineItemVideoView( modifier = Modifier .fillMaxWidth() .then(if (isLoaded) Modifier.background(Color.White) else Modifier), - model = MediaRequestData(content.thumbnailSource, MediaRequestData.Kind.File(content.body, content.mimeType)), + model = MediaRequestData( + source = content.thumbnailSource, + kind = MediaRequestData.Kind.File( + body = content.filename ?: content.body, + mimeType = content.mimeType + ) + ), contentScale = ContentScale.Fit, alignment = Alignment.Center, contentDescription = description,