Skip to content

Commit

Permalink
Remove duplicate clashing.
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJump committed Apr 22, 2024
1 parent 72bf55d commit 3fb6797
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion uSync.BackOffice/Services/SyncFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public IEnumerable<OrderedNodeInfo> MergeFolders(string[] folders, string extens
foreach (var item in items)
{
var itemKey = item.Value.Node.GetKey();
if (localKeys.Contains(itemKey)) {
if (localKeys.Contains(itemKey) && item.Value.Node.IsEmptyItem() is false) {
throw new Exception($"Duplicate: Item key {itemKey} already exists for {item.Key} - run uSync Health check for more info.");
}

Expand Down
5 changes: 4 additions & 1 deletion uSync.BackOffice/SyncHandlers/SyncHandlerContainerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ protected override IReadOnlyList<OrderedNodeInfo> GetMergedItems(string[] folder

private void CheckForDuplicates(IReadOnlyList<OrderedNodeInfo> items)
{
var duplicates = items.GroupBy(x => x.Key).Where(x => x.Skip(1).Any()).ToArray();
var duplicates = items
.Where(x => x.Node?.IsEmptyItem() is false)
.GroupBy(x => x.Key)
.Where(x => x.Skip(1).Any()).ToArray();

if (duplicates.Length > 0)
{
Expand Down

0 comments on commit 3fb6797

Please sign in to comment.