if the download card is pressed, the expired card shows up properly

This commit is contained in:
Abhinav Adduri 2017-07-25 10:58:18 -07:00
parent 1bfa6321b1
commit 57e0d17cbc
2 changed files with 10 additions and 7 deletions

View file

@ -144,12 +144,15 @@ $(document).ready(function() {
cd6: err cd6: err
}); });
document.l10n.formatValue('expiredPageHeader').then(translated => { if (err.message === 'notfound') {
$('.title').text(translated); location.reload();
}); } else {
$('#download-btn').attr('hidden', true); document.l10n.formatValue('expiredPageHeader').then(translated => {
$('#expired-img').removeAttr('hidden'); $('.title').text(translated);
console.log('The file has expired, or has already been deleted.'); });
$('#download-btn').attr('hidden', true);
$('#expired-img').removeAttr('hidden');
}
return; return;
}) })
.then(([decrypted, fname]) => { .then(([decrypted, fname]) => {

View file

@ -20,7 +20,7 @@ class FileReceiver extends EventEmitter {
xhr.onload = function(event) { xhr.onload = function(event) {
if (xhr.status === 404) { if (xhr.status === 404) {
reject( reject(
new Error('The file has expired, or has already been deleted.') new Error('notfound')
); );
return; return;
} }