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

fix: Videoplayer filenames

See merge request famedly/fluffychat!695
This commit is contained in:
Krille Fear 2022-01-27 20:20:45 +00:00
commit c387d59b1d
2 changed files with 4 additions and 4 deletions

View File

@ -66,8 +66,7 @@ class _AudioPlayerState extends State<AudioPlayerWidget> {
await widget.event.downloadAndDecryptAttachmentCached();
if (matrixFile == null) throw ('Download failed');
final tempDir = await getTemporaryDirectory();
final fileName =
widget.event.content.tryGet<String>('filename') ?? matrixFile.name;
final fileName = widget.event.infoMap['url'] as String;
final file = File('${tempDir.path}/$fileName');
await file.writeAsBytes(matrixFile.bytes);

View File

@ -40,8 +40,9 @@ class _EventVideoPlayerState extends State<EventVideoPlayer> {
final blob = html.Blob([videoFile.bytes]);
_networkUri = html.Url.createObjectUrlFromBlob(blob);
} else {
final tmpDir = await getTemporaryDirectory();
final file = File(tmpDir.path + videoFile.name);
final tempDir = await getTemporaryDirectory();
final fileName = widget.event.infoMap['url'] as String;
final file = File('${tempDir.path}/$fileName');
if (await file.exists() == false) {
await file.writeAsBytes(videoFile.bytes);
}