Skip to content

Commit

Permalink
From v13: Throw for duplicates ( Jumoo/uSync.Complete.Issues#225 )
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJump committed Apr 17, 2024
1 parent 5db50e4 commit 42b418e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions uSync.BackOffice/Services/SyncFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using System.Xml.Linq;
using System.Xml.Serialization;

using Examine;

using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

Expand Down Expand Up @@ -504,8 +506,18 @@ public IEnumerable<OrderedNodeInfo> MergeFolders(string[] folders, string extens

var items = GetFolderItems(absPath, extension);

var localKeys = new List<Guid>();

foreach (var item in items)
{
var itemKey = item.Value.Node.GetKey();
if (localKeys.Contains(itemKey))
{
throw new Exception($"Duplicate: Item key {itemKey} already exists for {item.Key} - run uSync Health check for more info.");
}

localKeys.Add(itemKey);

if (trackerBase is not null && elements.TryGetValue(item.Key, out var value))
{
// merge these files.
Expand Down

0 comments on commit 42b418e

Please sign in to comment.