Fix missing subject issues

pull/16/head
ClaraCrazy 2024-09-29 10:20:20 +02:00
parent 5a1d7c038d
commit 38cd67f881
2 changed files with 8 additions and 0 deletions

View File

@ -254,6 +254,8 @@ class ImapService extends EventEmitter {
.map(addressObj => addressObj.address) .map(addressObj => addressObj.address)
const from = headerPart.from.flatMap(from => addressparser(from)) const from = headerPart.from.flatMap(from => addressparser(from))
// Specify default subject, in case none exists.
let subject = "No Subject" let subject = "No Subject"
try { try {
subject = headerPart.subject[0] subject = headerPart.subject[0]

View File

@ -33,6 +33,12 @@ router.get(
req.params.uid req.params.uid
) )
if (mail) { if (mail) {
// Set a default subject if none is present
if (!mail.subject) {
mail.subject = 'No Subject'
}
// Emails are immutable, cache if found // Emails are immutable, cache if found
res.set('Cache-Control', 'private, max-age=600') res.set('Cache-Control', 'private, max-age=600')
res.render('mail', { res.render('mail', {