diff --git a/uSync.BackOffice/Services/SyncFileService.cs b/uSync.BackOffice/Services/SyncFileService.cs index cd4663c3..b9836e0a 100644 --- a/uSync.BackOffice/Services/SyncFileService.cs +++ b/uSync.BackOffice/Services/SyncFileService.cs @@ -6,6 +6,8 @@ using System.Xml.Linq; using System.Xml.Serialization; +using Examine; + using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; @@ -504,8 +506,18 @@ public IEnumerable MergeFolders(string[] folders, string extens var items = GetFolderItems(absPath, extension); + var localKeys = new List(); + 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.