From b402c1ffe3d760c5c2f27d80cc1e511b2cfa2d77 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Thu, 21 Nov 2024 12:54:38 +0100 Subject: [PATCH] Fixed issue where old images was not deleted when removed from the upload property editor, when it did not send null value. (#17587) Co-authored-by: Mole --- .../PropertyEditors/FileUploadPropertyValueEditor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs index beda0418f2..5040d14bbe 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs @@ -87,7 +87,7 @@ internal class FileUploadPropertyValueEditor : DataValueEditor FileUploadValue? editorModelValue = ParseFileUploadValue(editorValue.Value); // no change? - if (editorModelValue?.TemporaryFileId.HasValue is not true) + if (editorModelValue?.TemporaryFileId.HasValue is not true && string.IsNullOrEmpty(editorModelValue?.Src) is false) { return currentValue; } @@ -99,7 +99,7 @@ internal class FileUploadPropertyValueEditor : DataValueEditor : null; // resetting the current value? - if (editorModelValue?.Src is null && currentPath.IsNullOrWhiteSpace() is false) + if (string.IsNullOrEmpty(editorModelValue?.Src) && currentPath.IsNullOrWhiteSpace() is false) { // delete the current file and clear the value of this property _mediaFileManager.FileSystem.DeleteFile(currentPath);