handle reports for files that have been already been deleted
This commit is contained in:
parent
06daba9ce0
commit
d023a53b74
2 changed files with 7 additions and 4 deletions
|
@ -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);
|
||||
|
|
|
@ -90,6 +90,10 @@ module.exports = function(state, emit) {
|
|||
}
|
||||
}
|
||||
|
||||
if (state.fileInfo.dead) {
|
||||
return notFound(state);
|
||||
}
|
||||
|
||||
if (!state.transfer && !state.fileInfo.requiresPassword) {
|
||||
emit('getMetadata');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue