From 91309f6bdf83281378f9700fd49d42261313fb17 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sat, 29 Jan 2022 08:04:48 +0100 Subject: [PATCH] chore: Follow up fix filenames --- lib/pages/chat/events/audio_player.dart | 4 ++-- lib/pages/chat/events/video_player.dart | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pages/chat/events/audio_player.dart b/lib/pages/chat/events/audio_player.dart index 1b0889e4..44693285 100644 --- a/lib/pages/chat/events/audio_player.dart +++ b/lib/pages/chat/events/audio_player.dart @@ -68,8 +68,8 @@ class _AudioPlayerState extends State { if (matrixFile == null) throw ('Download failed'); final tempDir = await getTemporaryDirectory(); final fileName = Uri.encodeComponent( - widget.event.attachmentOrThumbnailMxcUrl()!.toString()); - final file = File('${tempDir.path}/$fileName'); + widget.event.attachmentOrThumbnailMxcUrl()!.pathSegments.last); + final file = File('${tempDir.path}/${fileName}_${matrixFile.name}'); await file.writeAsBytes(matrixFile.bytes); setState(() { diff --git a/lib/pages/chat/events/video_player.dart b/lib/pages/chat/events/video_player.dart index 20d2957f..dcadf78e 100644 --- a/lib/pages/chat/events/video_player.dart +++ b/lib/pages/chat/events/video_player.dart @@ -42,8 +42,8 @@ class _EventVideoPlayerState extends State { } else { final tempDir = await getTemporaryDirectory(); final fileName = Uri.encodeComponent( - widget.event.attachmentOrThumbnailMxcUrl()!.toString()); - final file = File('${tempDir.path}/$fileName'); + widget.event.attachmentOrThumbnailMxcUrl()!.pathSegments.last); + final file = File('${tempDir.path}/${fileName}_${videoFile.name}'); if (await file.exists() == false) { await file.writeAsBytes(videoFile.bytes); }