TF-106 Fix display inlined image CIDs of emails
This commit is contained in:
@@ -27,6 +27,8 @@ class Attachment with EquatableMixin {
|
||||
this.disposition,
|
||||
});
|
||||
|
||||
bool cidNotEmpty() => cid != null && cid!.isNotEmpty;
|
||||
|
||||
String getDownloadUrl(String baseDownloadUrl, AccountId accountId) {
|
||||
final downloadUriTemplate = UriTemplate('$baseDownloadUrl');
|
||||
final downloadUri = downloadUriTemplate.expand({
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:model/email/email_content_type.dart';
|
||||
import 'package:model/model.dart';
|
||||
|
||||
@@ -11,19 +10,6 @@ class EmailContent with EquatableMixin {
|
||||
|
||||
EmailContent(this.type, this.content);
|
||||
|
||||
bool hasImageInlineWithCid() => content.contains('cid:');
|
||||
|
||||
String getContentHasInlineAttachment(String baseDownloadUrl, AccountId accountId, List<Attachment> attachments) {
|
||||
var contentValid = content;
|
||||
attachments.forEach((attachment) {
|
||||
if(attachment.cid != null) {
|
||||
final urlDownloadImage = attachment.getDownloadUrl(baseDownloadUrl, accountId);
|
||||
contentValid = content.replaceAll('cid:${attachment.cid}', '$urlDownloadImage');
|
||||
}
|
||||
});
|
||||
return contentValid;
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [type, content];
|
||||
}
|
||||
Reference in New Issue
Block a user