diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 0b4089c7e..3fde53ba3 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -1,5 +1,9 @@ ## Upcoming +🐞 Fixed + +- Use file extension instead of mimeType for downloading files + ✅ Added - Videos can now be auto-played in `FullScreenMedia` diff --git a/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart b/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart index 0c10ae461..ac9213b6c 100644 --- a/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart @@ -365,12 +365,13 @@ class AttachmentActionsModal extends StatelessWidget { }) async { String? filePath; final appDocDir = await getTemporaryDirectory(); + final url = + attachment.assetUrl ?? attachment.imageUrl ?? attachment.thumbUrl!; await Dio().download( - attachment.assetUrl ?? attachment.imageUrl ?? attachment.thumbUrl!, + url, (Headers responseHeaders) { - final contentType = responseHeaders[Headers.contentTypeHeader]!; - final mimeType = contentType.first.split('/').last; - filePath ??= '${appDocDir.path}/${attachment.id}.$mimeType'; + final ext = Uri.parse(url).pathSegments.last; + filePath ??= '${appDocDir.path}/${attachment.id}.$ext'; return filePath!; }, onReceiveProgress: progressCallback,