From 91283cfe9c082bf4e35b55fce6a3ef7f80ae3e04 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 24 Mar 2026 16:18:07 -0600 Subject: [PATCH] fix for single file saving Signed-off-by: Andy Miller --- classes/plugin/AdminBaseController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/classes/plugin/AdminBaseController.php b/classes/plugin/AdminBaseController.php index 6ce6df43..a72bab3e 100644 --- a/classes/plugin/AdminBaseController.php +++ b/classes/plugin/AdminBaseController.php @@ -796,8 +796,13 @@ class AdminBaseController } elseif ($obj instanceof UserInterface and $key === 'avatar') { $obj->set($key, $files); } else { - // TODO: [this is JS handled] if it's single file, remove existing and use set, if it's multiple, use join - $obj->join($key, $files); // stores + // For single file fields, replace existing value to prevent stale file entries + $fieldSettings = $obj->blueprints()->schema()->getProperty($key); + if (is_array($fieldSettings) && empty($fieldSettings['multiple'])) { + $obj->set($key, $files); + } else { + $obj->join($key, $files); + } } }