diff --git a/modules/imap/handler_modules.php b/modules/imap/handler_modules.php index 6bce45a0b..9accf9126 100644 --- a/modules/imap/handler_modules.php +++ b/modules/imap/handler_modules.php @@ -1306,7 +1306,11 @@ public function process() { } $folders = array($folder); } else { - $data_sources = imap_data_sources('', $this->session->get('custom_imap_sources', user:true)); + $userCustomSources = $this->session->get('custom_imap_sources', user:true); + if (! $userCustomSources) { + $userCustomSources = []; + } + $data_sources = imap_data_sources('', $userCustomSources); $ids = array_map(function($ds) { return $ds['id']; }, $data_sources); $folders = array_map(function($ds) { return $ds['folder']; }, $data_sources); } diff --git a/modules/imap/hm-imap.php b/modules/imap/hm-imap.php index fbb8dbaa8..00e5a00db 100644 --- a/modules/imap/hm-imap.php +++ b/modules/imap/hm-imap.php @@ -940,7 +940,7 @@ public function get_message_list($uids, $raw=false, $include_preview = false) { $lines = explode("\r\n", $vals[$i]); foreach ($lines as $line) { $header = mb_strtolower(mb_substr($line, 0, mb_strpos($line, ':'))); - if (!$header || (!isset($flds[$header]) && $last_header)) { + if ($last_header && (!$header || !isset($flds[$header]))) { ${$flds[$last_header]} .= str_replace("\t", " ", $line); } elseif (isset($flds[$header])) { diff --git a/modules/imap/js_modules/route_handlers.js b/modules/imap/js_modules/route_handlers.js index a0f1a1a45..9fecbfbe5 100644 --- a/modules/imap/js_modules/route_handlers.js +++ b/modules/imap/js_modules/route_handlers.js @@ -29,7 +29,7 @@ function applyImapMessageListPageHandlers(routeParams) { } function applyImapMessageContentPageHandlers(routeParams) { - imap_setup_message_view_page(routeParams.uid, null, routeParams.list_path, handleExternalResources); + imap_setup_message_view_page(routeParams.uid, null, routeParams.list_path); imap_setup_snooze(); imap_setup_tags(); diff --git a/modules/imap/site.js b/modules/imap/site.js index 81aa5e56e..9d2371f59 100644 --- a/modules/imap/site.js +++ b/modules/imap/site.js @@ -743,6 +743,7 @@ var imap_message_view_finished = function(msg_uid, detail, skip_links) { }); fixLtrInRtl(); + handleExternalResources(); handleAttachementDownload(); handleViewMessagePart(); }; @@ -764,7 +765,6 @@ var imap_setup_message_view_page = function(uid, details, list_path, callback) { } const callbackFn = (...args) => { markPrefetchedMessagesAsRead(uid); - observeMessageTextMutationAndHandleExternalResources(); if (callback) { callback(...args); }