diff --git a/uSync.BackOffice/Services/SyncFileService.cs b/uSync.BackOffice/Services/SyncFileService.cs index 54efa059..98d060b9 100644 --- a/uSync.BackOffice/Services/SyncFileService.cs +++ b/uSync.BackOffice/Services/SyncFileService.cs @@ -11,6 +11,8 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; +using Org.BouncyCastle.Crypto.Engines; + using Umbraco.Cms.Core.Extensions; using Umbraco.Extensions; @@ -492,6 +494,8 @@ public IEnumerable MergeFolders(string[] folders, string extens { var elements = new Dictionary(); + var cleanElements = new Dictionary(); + foreach (var folder in folders) { var absPath = GetAbsPath(folder); @@ -516,9 +520,18 @@ public IEnumerable MergeFolders(string[] folders, string extens } else { - // empty if its anything but a delete we ignore it. - // renames are just markers to make sure they don't leave things on disk. - continue; + if (item.Value.Node.GetEmptyAction() == SyncActionType.Clean) + { + // cleans are added, these run a clean up at the end, so if they exist + // we need to add them, but they can clash in terms of keys. + _ = cleanElements.TryAdd(item.Key, item.Value); + } + else + { + // empty if its anything but a delete we ignore it. + // renames are just markers to make sure they don't leave things on disk. + continue; + } } if (elements.TryGetValue(item.Key, out var value)) @@ -532,7 +545,7 @@ public IEnumerable MergeFolders(string[] folders, string extens } } - return elements.Values; + return [..elements.Values, ..cleanElements.Values]; } ///