handle reports for files that have been already been deleted

This commit is contained in:
Danny Coates 2020-07-30 10:19:14 -07:00
parent 06daba9ce0
commit d023a53b74
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
2 changed files with 7 additions and 4 deletions

View file

@ -232,9 +232,7 @@ export default function(state, emitter) {
} catch (e) { } catch (e) {
if (e.message === '401' || e.message === '404') { if (e.message === '401' || e.message === '404') {
file.password = null; file.password = null;
if (!file.requiresPassword) { file.dead = e.message === '404';
return emitter.emit('pushState', '/404');
}
} else { } else {
console.error(e); console.error(e);
return emitter.emit('pushState', '/error'); return emitter.emit('pushState', '/error');
@ -320,7 +318,8 @@ export default function(state, emitter) {
emitter.on('report', async ({ reason }) => { emitter.on('report', async ({ reason }) => {
try { try {
await state.transfer.reportLink(reason); const receiver = state.transfer || new FileReceiver(state.fileInfo);
await receiver.reportLink(reason);
render(); render();
} catch (err) { } catch (err) {
console.error(err); console.error(err);

View file

@ -90,6 +90,10 @@ module.exports = function(state, emit) {
} }
} }
if (state.fileInfo.dead) {
return notFound(state);
}
if (!state.transfer && !state.fileInfo.requiresPassword) { if (!state.transfer && !state.fileInfo.requiresPassword) {
emit('getMetadata'); emit('getMetadata');
} }