TF-2602 Set charset for attachment with mimeType=text/plain when sent email on mobile

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2024-02-23 11:57:54 +07:00
committed by Dat H. Pham
parent b5d8776af9
commit 514bc578ec
8 changed files with 70 additions and 26 deletions
+12 -1
View File
@@ -20,6 +20,7 @@ class Attachment with EquatableMixin {
final MediaType? type;
final String? cid;
final ContentDisposition? disposition;
final String? charset;
Attachment({
this.partId,
@@ -29,6 +30,7 @@ class Attachment with EquatableMixin {
this.type,
this.cid,
this.disposition,
this.charset,
});
bool noCid() => cid == null || cid?.isEmpty == true;
@@ -59,7 +61,16 @@ class Attachment with EquatableMixin {
}
@override
List<Object?> get props => [partId, blobId, size, name, type, cid, disposition];
List<Object?> get props => [
partId,
blobId,
size,
name,
type,
cid,
disposition,
charset
];
}
enum ContentDisposition {
@@ -11,7 +11,7 @@ extension AttachmentExtension on Attachment {
name: name,
type: type,
cid: cid,
charset: charset,
charset: charset ?? this.charset,
disposition: disposition?.name ?? ContentDisposition.attachment.name);
Attachment toAttachmentWithDisposition({
@@ -25,7 +25,8 @@ extension AttachmentExtension on Attachment {
name: name,
type: type,
cid: cid ?? this.cid,
disposition: disposition ?? this.disposition
disposition: disposition ?? this.disposition,
charset: charset
);
}
@@ -9,5 +9,6 @@ extension EmailBodyPartExtension on EmailBodyPart {
name: name,
type: type,
cid: cid,
charset: charset,
disposition: disposition.toContentDisposition());
}
+8 -2
View File
@@ -34,7 +34,13 @@ class UploadResponse with EquatableMixin {
}
extension UploadResponseExtension on UploadResponse {
Attachment toAttachment(String nameFile) {
return Attachment(blobId: blobId, size: UnsignedInt(size), name: nameFile, type: type);
Attachment toAttachment({required String nameFile, String? charset}) {
return Attachment(
blobId: blobId,
size: UnsignedInt(size),
name: nameFile,
type: type,
charset: charset
);
}
}