From fb8ee6dca3c85ba52705a863e34c24a21a0972e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=8B?= <​> Date: Sun, 24 Dec 2023 21:06:09 +0100 Subject: [PATCH] Update missing email 404 page --- application/imap-service.js | 3 +-- infrastructure/web/routes/inbox.js | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/application/imap-service.js b/application/imap-service.js index 5c8dda2..cbfa672 100644 --- a/application/imap-service.js +++ b/application/imap-service.js @@ -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) } diff --git a/infrastructure/web/routes/inbox.js b/infrastructure/web/routes/inbox.js index 7710227..387e962 100644 --- a/infrastructure/web/routes/inbox.js +++ b/infrastructure/web/routes/inbox.js @@ -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)