From 374cefaf641e8308bd7a379cb255e716d2a2864b Mon Sep 17 00:00:00 2001 From: Krille Fear Date: Fri, 28 Jan 2022 20:43:59 +0100 Subject: [PATCH] chore: Follow up fix uri encoding --- lib/pages/chat/events/audio_player.dart | 3 ++- lib/pages/chat/events/video_player.dart | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pages/chat/events/audio_player.dart b/lib/pages/chat/events/audio_player.dart index c94e9921..1b0889e4 100644 --- a/lib/pages/chat/events/audio_player.dart +++ b/lib/pages/chat/events/audio_player.dart @@ -67,7 +67,8 @@ class _AudioPlayerState extends State { await widget.event.downloadAndDecryptAttachmentCached(); if (matrixFile == null) throw ('Download failed'); final tempDir = await getTemporaryDirectory(); - final fileName = widget.event.attachmentOrThumbnailMxcUrl()!.toString(); + final fileName = Uri.encodeComponent( + widget.event.attachmentOrThumbnailMxcUrl()!.toString()); final file = File('${tempDir.path}/$fileName'); await file.writeAsBytes(matrixFile.bytes); diff --git a/lib/pages/chat/events/video_player.dart b/lib/pages/chat/events/video_player.dart index 6d11af7f..20d2957f 100644 --- a/lib/pages/chat/events/video_player.dart +++ b/lib/pages/chat/events/video_player.dart @@ -41,7 +41,8 @@ class _EventVideoPlayerState extends State { _networkUri = html.Url.createObjectUrlFromBlob(blob); } else { final tempDir = await getTemporaryDirectory(); - final fileName = widget.event.attachmentOrThumbnailMxcUrl()!.toString(); + final fileName = Uri.encodeComponent( + widget.event.attachmentOrThumbnailMxcUrl()!.toString()); final file = File('${tempDir.path}/$fileName'); if (await file.exists() == false) { await file.writeAsBytes(videoFile.bytes);