@@ -436,20 +436,19 @@ export default class SyncProcess {
436
436
this . cacheTreeRoot ,
437
437
this . localTreeRoot ,
438
438
// We also allow canMergeWith for folders here, because Window IDs are not stable
439
+ // If a bookmark's URL has changed we want to recreate it instead of updating it, because of Nextcloud Bookmarks' uniqueness constraints
439
440
( oldItem , newItem ) => {
440
441
if ( oldItem . type !== newItem . type ) {
441
442
return false
442
443
}
443
- if ( oldItem . type === 'bookmark' && newItem . type === 'bookmark' ) {
444
- return oldItem . url === newItem . url
444
+ if ( oldItem . type === 'bookmark' && newItem . type === 'bookmark' && oldItem . url !== newItem . url ) {
445
+ return false
445
446
}
446
- if ( oldItem . type === 'folder' ) {
447
- if ( String ( oldItem . id ) === String ( newItem . id ) ) {
448
- return true
449
- }
450
- if ( oldItem . canMergeWith ( newItem ) ) {
451
- return true
452
- }
447
+ if ( Mappings . mappable ( mappingsSnapshot , oldItem , newItem ) ) {
448
+ return true
449
+ }
450
+ if ( oldItem . type === 'folder' && oldItem . canMergeWith ( newItem ) ) {
451
+ return true
453
452
}
454
453
return false
455
454
} ,
@@ -461,22 +460,21 @@ export default class SyncProcess {
461
460
// We also allow canMergeWith here
462
461
// (for bookmarks, because e.g. for NextcloudFolders the id of moved bookmarks changes (because their id is "<bookmarkID>;<folderId>")
463
462
// (for folders because Window IDs are not stable)
463
+ // If a bookmark's URL has changed we want to recreate it instead of updating it, because of Nextcloud Bookmarks' uniqueness constraints
464
464
( oldItem , newItem ) => {
465
465
if ( oldItem . type !== newItem . type ) {
466
466
return false
467
467
}
468
- if ( oldItem . type === 'bookmark' && newItem . type === 'bookmark' ) {
469
- return oldItem . url === newItem . url
468
+ if ( oldItem . type === 'bookmark' && newItem . type === 'bookmark' && oldItem . url !== newItem . url ) {
469
+ return false
470
470
}
471
- if ( oldItem . type === 'folder' ) {
472
- if ( Mappings . mappable ( mappingsSnapshot , oldItem , newItem ) ) {
473
- newMappings . push ( [ oldItem , newItem ] )
474
- return true
475
- }
476
- if ( oldItem . canMergeWith ( newItem ) ) {
477
- newMappings . push ( [ oldItem , newItem ] )
478
- return true
479
- }
471
+ if ( Mappings . mappable ( mappingsSnapshot , oldItem , newItem ) ) {
472
+ newMappings . push ( [ oldItem , newItem ] )
473
+ return true
474
+ }
475
+ if ( oldItem . canMergeWith ( newItem ) ) {
476
+ newMappings . push ( [ oldItem , newItem ] )
477
+ return true
480
478
}
481
479
return false
482
480
} ,
@@ -491,15 +489,12 @@ export default class SyncProcess {
491
489
if ( oldItem . type !== newItem . type ) {
492
490
return false
493
491
}
494
- if ( oldItem . type === 'folder' ) {
495
- if ( String ( oldItem . id ) === String ( newItem . id ) ) {
496
- return true
497
- }
492
+ // If a bookmark's URL has changed we want to recreate it instead of updating it, because of Nextcloud Bookmarks' uniqueness constraints
493
+ if ( oldItem . type === 'bookmark' && newItem . type === 'bookmark' && oldItem . url !== newItem . url ) {
494
+ return false
498
495
}
499
- if ( oldItem . type === 'bookmark' && newItem . type === 'bookmark' ) {
500
- if ( String ( oldItem . id ) === String ( newItem . id ) && oldItem . url === newItem . url ) {
501
- return true
502
- }
496
+ if ( Mappings . mappable ( mappingsSnapshot , oldItem , newItem ) ) {
497
+ return true
503
498
}
504
499
return false
505
500
} ,
@@ -508,22 +503,20 @@ export default class SyncProcess {
508
503
serverScanner = new Scanner (
509
504
this . cacheTreeRoot ,
510
505
this . serverTreeRoot ,
511
- // We also allow canMergeWith here, because e.g. for NextcloudFolders the id of moved bookmarks changes (because their id is "<bookmarkID>;<folderId>")
506
+ // We also allow canMergeWith here, because e.g. for NextcloudBookmarks the id of moved bookmarks changes (because their id is "<bookmarkID>;<folderId>")
512
507
( oldItem , newItem ) => {
513
508
if ( oldItem . type !== newItem . type ) {
514
509
return false
515
510
}
516
- if ( oldItem . type === 'folder' ) {
517
- if ( Mappings . mappable ( mappingsSnapshot , oldItem , newItem ) ) {
518
- newMappings . push ( [ oldItem , newItem ] )
519
- return true
520
- }
511
+ // If a bookmark's URL has changed we want to recreate it instead of updating it, because of Nextcloud Bookmarks' uniqueness constraints
512
+ if ( oldItem . type === 'bookmark' && newItem . type === 'bookmark' && oldItem . url !== newItem . url ) {
513
+ return false
514
+ }
515
+ if ( Mappings . mappable ( mappingsSnapshot , oldItem , newItem ) ) {
516
+ newMappings . push ( [ oldItem , newItem ] )
517
+ return true
521
518
}
522
519
if ( oldItem . type === 'bookmark' && newItem . type === 'bookmark' ) {
523
- if ( Mappings . mappable ( mappingsSnapshot , oldItem , newItem ) && oldItem . url === newItem . url ) {
524
- newMappings . push ( [ oldItem , newItem ] )
525
- return true
526
- }
527
520
if ( oldItem . canMergeWith ( newItem ) ) {
528
521
newMappings . push ( [ oldItem , newItem ] )
529
522
return true
0 commit comments