Theming: Check valid image format also for logo

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2017-09-20 13:33:42 +02:00
parent c337c8fa45
commit c0d104087b
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 12 additions and 0 deletions

View File

@ -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'];