Merge branch 'krille/fix-filenames' into 'main'

chore: Follow up fix filenames

See merge request famedly/fluffychat!700
This commit is contained in:
Krille Fear 2022-01-29 07:21:24 +00:00
commit ded70a7fce
2 changed files with 4 additions and 4 deletions

View File

@ -68,8 +68,8 @@ class _AudioPlayerState extends State<AudioPlayerWidget> {
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(() {

View File

@ -42,8 +42,8 @@ class _EventVideoPlayerState extends State<EventVideoPlayer> {
} 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);
}