Update missing email 404 page

pull/1/head
2023-12-24 21:06:09 +01:00
parent 7f8630422c
commit fb8ee6dca3
2 changed files with 3 additions and 4 deletions

View File

@ -279,9 +279,8 @@ class ImapService extends EventEmitter {
const messages = await this.connection.search(searchCriteria, fetchOptions)
if (messages.length === 0) {
throw new Error('email not found')
return("womp womp")
}
const fullBody = _.find(messages[0].parts, {which: ''})
return simpleParser(fullBody.body)
}

View File

@ -32,7 +32,7 @@ router.get(
req.params.address,
req.params.uid
)
if (mail) {
if (mail && !mail == "womp womp") {
// Emails are immutable, cache if found
res.set('Cache-Control', 'private, max-age=600')
res.render('mail', {
@ -44,7 +44,7 @@ router.get(
madebysite: config.branding[2]
})
} else {
next({message: 'email not found', status: 404})
next({message: 'This mail could not be found. It either does not exist or has been deleted from our servers!', status: 404})
}
} catch (error) {
console.error('error while fetching one email', error)