Never store invalid OO checkpoints

pull/1/head
yflory 4 years ago committed by ansuz
parent c57400ab9c
commit ac87576360

@ -477,6 +477,18 @@ define([
var saveToServer = function () {
if (APP.cantCheckpoint) { return; } // TOO_LARGE
var text = getContent();
text = undefined;
if (!text) {
setEditable(false, true);
sframeChan.query('Q_CLEAR_CACHE_CHANNELS', [
'chainpad',
content.channel,
], function () {});
UI.alert(Messages.realtime_unrecoverableError, function () {
common.gotoURL();
});
return;
}
var blob = new Blob([text], {type: 'plain/text'});
var file = getFileType();
blob.name = (metadataMgr.getMetadataLazy().title || file.doc) + '.' + file.type;

@ -1533,6 +1533,16 @@ define([
sframeChan.on('Q_CLEAR_CACHE', function (data, cb) {
Utils.Cache.clear(cb);
});
sframeChan.on('Q_CLEAR_CACHE_CHANNELS', function (channels, cb) {
if (!Array.isArray(channels)) { return void cb({error: "NOT_AN_ARRAY"}); }
nThen(function (waitFor) {
channels.forEach(function (chan) {
if (chan === "chainpad") { chan = secret.channel; }
console.error(chan);
Utils.Cache.clearChannel(chan, waitFor());
});
}).nThen(cb);
});
sframeChan.on('Q_PIN_GET_USAGE', function (teamId, cb) {
Cryptpad.isOverPinLimit(teamId, function (err, overLimit, data) {

Loading…
Cancel
Save