handle 'DISCONNECTED' error to avoid a password prompt or a cached file
This commit is contained in:
parent
077b3fe635
commit
6c134a678b
1 changed files with 5 additions and 0 deletions
|
@ -408,6 +408,8 @@ define([
|
|||
// `isNewChannel` doesn't work for files (not a channel)
|
||||
// `getFileSize` is not adapted to channels because of metadata
|
||||
Cryptpad.getFileSize(currentPad.href, password, w(function (e, size) {
|
||||
console.error('GET_FILE_SIZE', e, size);
|
||||
if (e === 'DISCONNECTED') { return void todo(); } // XXX handle disconnected case
|
||||
if (size !== 0) { return void todo(); }
|
||||
// Wrong password or deleted file?
|
||||
askPassword(true, passwordCfg);
|
||||
|
@ -416,6 +418,9 @@ define([
|
|||
}
|
||||
// Not a file, so we can use `isNewChannel`
|
||||
Cryptpad.isNewChannel(currentPad.href, password, w(function(e, isNew) {
|
||||
console.error('IS_NEW_CHANNEL', e, isNew);
|
||||
if (e === 'DISCONNECTED') { return void todo(); } // XXX if offline just proceed to use the cache?
|
||||
|
||||
if (isNew && expire && expire < (+new Date())) {
|
||||
sframeChan.event("EV_EXPIRED_ERROR");
|
||||
waitFor.abort();
|
||||
|
|
Loading…
Reference in a new issue