Skip to content

Commit 6cfb129

Browse files
cristianscheidsusnux
authored andcommitted
fix(theming): display error messages on image upload and delete previous image only after validation
Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
1 parent 30d644a commit 6cfb129

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/theming/lib/ImageManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,6 @@ public function delete(string $key): void {
202202
}
203203

204204
public function updateImage(string $key, string $tmpFile): string {
205-
$this->delete($key);
206-
207205
try {
208206
$folder = $this->getRootFolder()->getFolder('images');
209207
} catch (NotFoundException $e) {
@@ -217,6 +215,8 @@ public function updateImage(string $key, string $tmpFile): string {
217215
throw new \Exception('Unsupported image type: ' . $detectedMimeType);
218216
}
219217

218+
$this->delete($key);
219+
220220
if ($key === 'background') {
221221
if ($this->shouldOptimizeBackgroundImage($detectedMimeType, filesize($tmpFile))) {
222222
try {

0 commit comments

Comments
 (0)