Skip to content

Commit

Permalink
Fixed issue where old images was not deleted when removed from the up…
Browse files Browse the repository at this point in the history
…load property editor, when it did not send null value. (#17587)

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
  • Loading branch information
bergmania and nikolajlauridsen authored Nov 21, 2024
1 parent 5518c70 commit b402c1f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public FileUploadPropertyValueEditor(
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;
}
Expand All @@ -99,7 +99,7 @@ public FileUploadPropertyValueEditor(
: 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);
Expand Down

0 comments on commit b402c1f

Please sign in to comment.