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) {
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);

View file

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