From 5fb73be33cb434a0d0af58180afae523ddc99069 Mon Sep 17 00:00:00 2001 From: Kevin Jump Date: Tue, 30 Apr 2024 18:23:47 +0100 Subject: [PATCH] cater for "clean" files. --- uSync.BackOffice/Services/SyncFileService.cs | 21 ++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) 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]; } ///