File tree Expand file tree Collapse file tree 2 files changed +55
-1
lines changed Expand file tree Collapse file tree 2 files changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -429,7 +429,9 @@ export default class NextcloudFoldersAdapter extends Adapter {
429
429
bm . id = json . item . id + ';' + bm . parentId
430
430
}
431
431
// add bookmark to cached list
432
- this . list . push ( bm )
432
+ let upstreamMark = bm . clone ( )
433
+ upstreamMark . id = bm . id . split ( ';' ) [ 0 ]
434
+ this . list . push ( upstreamMark )
433
435
434
436
return bm . id
435
437
} )
Original file line number Diff line number Diff line change @@ -450,6 +450,58 @@ describe('Floccus', function() {
450
450
ACCOUNT_DATA . type === 'nextcloud'
451
451
)
452
452
} )
453
+ it ( 'should be able to handle duplicates' , async function ( ) {
454
+ var adapter = account . server
455
+ expect ( ( await adapter . getBookmarksTree ( ) ) . children ) . to . have . lengthOf (
456
+ 0
457
+ )
458
+
459
+ const localRoot = account . getData ( ) . localRoot
460
+ const bookmarkData = {
461
+ title : 'url' ,
462
+ url : 'http://ur.l/'
463
+ }
464
+ const fooFolder = await browser . bookmarks . create ( {
465
+ title : 'foo' ,
466
+ parentId : localRoot
467
+ } )
468
+ const bookmark1 = await browser . bookmarks . create ( {
469
+ ...bookmarkData ,
470
+ parentId : fooFolder . id
471
+ } )
472
+ const barFolder = await browser . bookmarks . create ( {
473
+ title : 'bar' ,
474
+ parentId : fooFolder . id
475
+ } )
476
+ const bookmark2 = await browser . bookmarks . create ( {
477
+ ...bookmarkData ,
478
+ parentId : barFolder . id
479
+ } )
480
+ await account . sync ( ) // propagate to server
481
+
482
+ await browser . bookmarks . move ( barFolder . id , { parentId : localRoot } )
483
+ await account . sync ( ) // update on server
484
+ expect ( account . getData ( ) . error ) . to . not . be . ok
485
+
486
+ const tree = await adapter . getBookmarksTree ( )
487
+ expectTreeEqual (
488
+ tree ,
489
+ new Folder ( {
490
+ title : tree . title ,
491
+ children : [
492
+ new Folder ( {
493
+ title : 'foo' ,
494
+ children : [ new Bookmark ( bookmarkData ) ]
495
+ } ) ,
496
+ new Folder ( {
497
+ title : 'bar' ,
498
+ children : [ new Bookmark ( bookmarkData ) ]
499
+ } )
500
+ ]
501
+ } ) ,
502
+ ACCOUNT_DATA . type === 'nextcloud'
503
+ )
504
+ } )
453
505
it ( 'should not fail when moving both folders and contents' , async function ( ) {
454
506
var adapter = account . server
455
507
expect ( ( await adapter . getBookmarksTree ( ) ) . children ) . to . have . lengthOf (
You can’t perform that action at this time.
0 commit comments