TF-3514 Detect base64 image to transfer it to cid attachment

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-03-05 14:26:32 +07:00
committed by Dat H. Pham
parent 5c6a995107
commit 4765921a35
25 changed files with 367 additions and 231 deletions
@@ -13,6 +13,7 @@ extension DetailedEmailHiveCacheExtension on DetailedEmailHiveCache {
emailId: EmailId(Id(emailId)),
createdTime: timeSaved,
attachments: attachments?.toAttachment(),
emailContentPath: emailContentPath,
headers: headers?.toSetEmailHeader(),
keywords: keywords != null
? Map.fromIterables(keywords!.keys.map((value) => KeyWordIdentifier(value)), keywords!.values)
@@ -68,7 +68,7 @@ class GetEmailContentInteractor {
additionalProperties: additionalProperties);
final listAttachments = email.allAttachments.getListAttachmentsDisplayedOutside(email.htmlBodyAttachments);
final listInlineImages = email.allAttachments.listAttachmentsDisplayedInContent;
log('GetEmailContentInteractor::_getContentEmailFromServer: listAttachments = ${listAttachments.length} | listInlineImages = ${listInlineImages.length}');
if (email.emailContentList.isNotEmpty) {
final mapCidImageDownloadUrl = listInlineImages.toMapCidImageDownloadUrl(
accountId: accountId,
@@ -109,8 +109,8 @@ class GetEmailContentInteractor {
{Properties? additionalProperties}
) async* {
try {
log('GetEmailContentInteractor::_getStoredOpenedEmail(): CALLED');
final detailedEmail = await emailRepository.getStoredOpenedEmail(session, accountId, emailId);
log('GetEmailContentInteractor::_getStoredOpenedEmail: attachments = ${detailedEmail.attachments?.length} | inlineImages = ${detailedEmail.inlineImages?.length}');
yield Right<Failure, Success>(GetEmailContentFromCacheSuccess(
htmlEmailContent: detailedEmail.htmlEmailContent ?? '',
attachments: detailedEmail.attachments ?? [],
@@ -144,8 +144,8 @@ class GetEmailContentInteractor {
{Properties? additionalProperties}
) async* {
try {
log('GetEmailContentInteractor::_getStoredNewEmail():CALLED');
final detailedEmail = await emailRepository.getStoredNewEmail(session, accountId, emailId);
log('GetEmailContentInteractor::_getStoredNewEmail: attachments = ${detailedEmail.attachments?.length} | inlineImages = ${detailedEmail.inlineImages?.length}');
yield Right<Failure, Success>(GetEmailContentFromCacheSuccess(
htmlEmailContent: detailedEmail.htmlEmailContent ?? '',
attachments: detailedEmail.attachments ?? [],