Browse Source
Theming: Check valid image format also for logo
Signed-off-by: Julius Härtl <jus@bitgrid.net>
pull/6585/head
Julius Härtl
9 years ago
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with
12 additions and
0 deletions
-
apps/theming/lib/Controller/ThemingController.php
|
|
|
@ -248,6 +248,18 @@ class ThemingController extends Controller { |
|
|
|
|
|
|
|
if (!empty($newLogo)) { |
|
|
|
$target = $folder->newFile('logo'); |
|
|
|
$supportedFormats = ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'text/svg']; |
|
|
|
if (!in_array($newLogo['type'], $supportedFormats)) { |
|
|
|
return new DataResponse( |
|
|
|
[ |
|
|
|
'data' => [ |
|
|
|
'message' => $this->l10n->t('Unsupported image type'), |
|
|
|
], |
|
|
|
'status' => 'failure', |
|
|
|
], |
|
|
|
Http::STATUS_UNPROCESSABLE_ENTITY |
|
|
|
); |
|
|
|
} |
|
|
|
$target->putContent(file_get_contents($newLogo['tmp_name'], 'r')); |
|
|
|
$this->themingDefaults->set('logoMime', $newLogo['type']); |
|
|
|
$name = $newLogo['name']; |
|
|
|
|