fix(theming): display error messages on image upload and delete previous image only after validation

Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
This commit is contained in:
Cristian Scheid 2026-02-02 14:16:18 -03:00 committed by Ferdinand Thiessen
parent 30d644a5a5
commit 6cfb12993e

View file

@ -202,8 +202,6 @@ class ImageManager {
}
public function updateImage(string $key, string $tmpFile): string {
$this->delete($key);
try {
$folder = $this->getRootFolder()->getFolder('images');
} catch (NotFoundException $e) {
@ -217,6 +215,8 @@ class ImageManager {
throw new \Exception('Unsupported image type: ' . $detectedMimeType);
}
$this->delete($key);
if ($key === 'background') {
if ($this->shouldOptimizeBackgroundImage($detectedMimeType, filesize($tmpFile))) {
try {