From 5d6aa7c48a8116840ce35691cf08df885919a9ab Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Fri, 16 Sep 2022 18:40:29 +1200 Subject: [PATCH] UI: Support for inline images using filenames instead of cid Some historic email programs use the attachment filename instead of a reference cid for inline images (eg: Outlook). --- server/ui-src/App.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/ui-src/App.vue b/server/ui-src/App.vue index b231ce4..c2361f2 100644 --- a/server/ui-src/App.vue +++ b/server/ui-src/App.vue @@ -173,6 +173,12 @@ export default { new RegExp('cid:'+a.ContentID, 'g'), window.location.origin+'/api/'+d.ID+'/part/'+a.PartID ); + } else if (a.FileName.match(/^[a-zA-Z\_\-\.]+$/)) { + // some old email clients use the filename + d.HTML = d.HTML.replace( + new RegExp('src=(\'|")'+a.FileName+'(\'|")', 'g'), + 'src="'+window.location.origin+'/api/'+d.ID+'/part/'+a.PartID+'"' + ); } } } @@ -185,6 +191,12 @@ export default { new RegExp('cid:'+a.ContentID, 'g'), window.location.origin+'/api/'+d.ID+'/part/'+a.PartID ); + } else if (a.FileName.match(/^[a-zA-Z\_\-\.]+$/)) { + // some old email clients use the filename + d.HTML = d.HTML.replace( + new RegExp('src=(\'|")'+a.FileName+'(\'|")', 'g'), + 'src="'+window.location.origin+'/api/'+d.ID+'/part/'+a.PartID+'"' + ); } } }