refactor: Make file events more fail safe for failed to send
This commit is contained in:
parent
084801fd84
commit
fc7eb6954c
2 changed files with 9 additions and 7 deletions
|
|
@ -165,11 +165,11 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
|||
: null,
|
||||
);
|
||||
|
||||
if (!kIsWeb) {
|
||||
final attachmentUrl = widget.event.attachmentOrThumbnailMxcUrl();
|
||||
|
||||
if (!kIsWeb && attachmentUrl != null) {
|
||||
final tempDir = await getTemporaryDirectory();
|
||||
final fileName = Uri.encodeComponent(
|
||||
widget.event.attachmentOrThumbnailMxcUrl()!.pathSegments.last,
|
||||
);
|
||||
final fileName = Uri.encodeComponent(attachmentUrl.pathSegments.last);
|
||||
file = File('${tempDir.path}/${fileName}_${matrixFile.name}');
|
||||
|
||||
await file.writeAsBytes(matrixFile.bytes);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue