Skip to content

Commit 17c9876

Browse files
author
Sebastian Kippe
authored
Merge pull request #1160 from iLiviu/bugfix/1150-baseclient.remove_while_offline
do not return common revision if local node was marked for deletion
2 parents 53e7271 + 39619c9 commit 17c9876

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/cachinglayer.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ function getLatest(node) {
3232
return node.common;
3333
}
3434
} else {
35-
if (node.local && node.local.body && node.local.contentType) {
36-
return node.local;
35+
if (node.local) {
36+
if (node.local.body && node.local.contentType) {
37+
return node.local;
38+
}
39+
if (node.local.body === false) {
40+
return;
41+
}
3742
}
3843
if (node.common && node.common.body && node.common.contentType) {
3944
return node.common;

test/unit/cachinglayer-suite.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ define(['require', './src/util', './src/config', './src/inmemorystorage'], funct
5454
body: 'asdf',
5555
contentType: 'text/plain'
5656
};
57+
deletedLocalNode = {
58+
path: '/a/b',
59+
local: { body: false },
60+
common: { body: 'b', contentType: 'c' },
61+
push: { foo: 'bar' },
62+
remote: { foo: 'bar' }
63+
}
5764

5865
test.assertAnd(getLatest(undefined), undefined);
5966
test.assertAnd(getLatest({local: { revision: 1, timestamp: 1 }}), undefined);
@@ -63,6 +70,7 @@ define(['require', './src/util', './src/config', './src/inmemorystorage'], funct
6370
test.assertAnd(getLatest(commonNode).contentType, 'c');
6471
test.assertAnd(getLatest(legacyNode).body, 'asdf');
6572
test.assertAnd(getLatest(legacyNode).contentType, 'text/plain');
73+
test.assertAnd(getLatest(deletedLocalNode), undefined);
6674
test.done();
6775
}
6876
},

0 commit comments

Comments
 (0)