aboutsummaryrefslogtreecommitdiff
path: root/src/modules/serverSideStorage.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2022-08-16 19:33:34 +0300
committerHenry Jameson <me@hjkos.com>2022-08-16 19:33:34 +0300
commit04acf069d1600f097805ce52f958263e68e153c1 (patch)
tree6428fdb6815c129c0b25da219759006df43d86f8 /src/modules/serverSideStorage.js
parent840ce063971d68063d380fc5f3aacc0564363b50 (diff)
ignore invalid journal entries
Diffstat (limited to 'src/modules/serverSideStorage.js')
-rw-r--r--src/modules/serverSideStorage.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/modules/serverSideStorage.js b/src/modules/serverSideStorage.js
index 08b11b0b..56164be7 100644
--- a/src/modules/serverSideStorage.js
+++ b/src/modules/serverSideStorage.js
@@ -132,7 +132,15 @@ export const _mergeFlags = (recent, stale, allFlagKeys) => {
}
const _mergeJournal = (...journals) => {
- const allJournals = flatten(journals.map(j => Array.isArray(j) ? j : []))
+ // Ignore invalid journal entries
+ const allJournals = flatten(
+ journals.map(j => Array.isArray(j) ? j : [])
+ ).filter(entry =>
+ Object.prototype.hasOwnProperty.call(entry, 'path') &&
+ Object.prototype.hasOwnProperty.call(entry, 'operation') &&
+ Object.prototype.hasOwnProperty.call(entry, 'args') &&
+ Object.prototype.hasOwnProperty.call(entry, 'timestamp')
+ )
const grouped = groupBy(allJournals, 'path')
const trimmedGrouped = Object.entries(grouped).map(([path, journal]) => {
// side effect