Skip to content

Commit 6091854

Browse files
committed
Fixed rc1 regression erasing very big (chunked) policies from sync storage.
1 parent 6527502 commit 6091854

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

common/Storage.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,25 @@ var Storage = (() => {
5151
if (!k.endsWith("/0")) continue;
5252
const [keyName] = k.split("/");
5353
if (allSyncData[keyName] !== "[CHUNKED]") {
54-
// not flagged as chunked, bail out and doome the remnants
54+
// not flagged as chunked, bail out and doom the remnants
5555
continue;
5656
}
5757
const ccKey = chunksKey(keyName);
58-
let count = parseInt(allSyncData[ccKey]);
59-
let contiguousKeys = [];
58+
const count = parseInt(allSyncData[ccKey]);
59+
const contiguousKeys = [];
6060
const keyPrefix = keyName.concat('/');
6161
for (let j = 1;; j++) {
6262
contiguousKeys.push(k);
6363
if (j >= count) break;
6464
k = keyPrefix.concat(j);
6565
if (!keys.includes(k)) break;
6666
}
67-
let actualCount = contiguousKeys.length;
68-
if (count === actualCount) continue;
69-
// try to repair
70-
repaired[ccKey] = actualCount;
7167
safeKeys.push(ccKey, ...contiguousKeys);
68+
const actualCount = contiguousKeys.length;
69+
if (count !== actualCount) {
70+
// try to repair
71+
repaired[ccKey] = actualCount;
72+
}
7273
}
7374

7475
const doomedKeys = keys.filter(k => chunkedRx.test(k) && !safeKeys.includes(k));

0 commit comments

Comments
 (0)