fix: incorrect mimeType for files when downloading
This commit is contained in:
parent
ef2c7a628e
commit
563629142d
|
|
@ -792,7 +792,11 @@ class Event extends MatrixEvent {
|
||||||
throw ('Unable to decrypt file');
|
throw ('Unable to decrypt file');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return MatrixFile(bytes: uint8list, name: body);
|
return MatrixFile(
|
||||||
|
bytes: uint8list,
|
||||||
|
name: body,
|
||||||
|
mimeType: attachmentMimetype,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns if this is a known event type.
|
/// Returns if this is a known event type.
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,10 @@ class MatrixFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixFile({required this.bytes, required String name, String? mimeType})
|
MatrixFile({required this.bytes, required String name, String? mimeType})
|
||||||
: mimeType = mimeType ??
|
: mimeType = mimeType != null && mimeType.isNotEmpty
|
||||||
lookupMimeType(name, headerBytes: bytes) ??
|
? mimeType
|
||||||
'application/octet-stream',
|
: lookupMimeType(name, headerBytes: bytes) ??
|
||||||
|
'application/octet-stream',
|
||||||
name = name.split('/').last;
|
name = name.split('/').last;
|
||||||
|
|
||||||
/// derivatives the MIME type from the [bytes] and correspondingly creates a
|
/// derivatives the MIME type from the [bytes] and correspondingly creates a
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue