From d023a53b7439c10ff9fb8b0a78de34541245942c Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Thu, 30 Jul 2020 10:19:14 -0700 Subject: [PATCH] handle reports for files that have been already been deleted --- app/controller.js | 7 +++---- app/ui/download.js | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controller.js b/app/controller.js index 61157a0f..969f9561 100644 --- a/app/controller.js +++ b/app/controller.js @@ -232,9 +232,7 @@ export default function(state, emitter) { } catch (e) { if (e.message === '401' || e.message === '404') { file.password = null; - if (!file.requiresPassword) { - return emitter.emit('pushState', '/404'); - } + file.dead = e.message === '404'; } else { console.error(e); return emitter.emit('pushState', '/error'); @@ -320,7 +318,8 @@ export default function(state, emitter) { emitter.on('report', async ({ reason }) => { try { - await state.transfer.reportLink(reason); + const receiver = state.transfer || new FileReceiver(state.fileInfo); + await receiver.reportLink(reason); render(); } catch (err) { console.error(err); diff --git a/app/ui/download.js b/app/ui/download.js index 457bab23..cace912c 100644 --- a/app/ui/download.js +++ b/app/ui/download.js @@ -90,6 +90,10 @@ module.exports = function(state, emit) { } } + if (state.fileInfo.dead) { + return notFound(state); + } + if (!state.transfer && !state.fileInfo.requiresPassword) { emit('getMetadata'); }