diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-10-16 12:13:16 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-10-16 12:35:51 +0200 |
commit | 9cfbf7ed1c92b262984488eaa9cee5df88419d5b (patch) | |
tree | 6f8368b3971813a7383b519e560854f7f2afa2e1 /lib/private/preview.php | |
parent | 756f64d728ccb9ef9bc6ba2ca965064827003231 (diff) | |
download | nextcloud-server-9cfbf7ed1c92b262984488eaa9cee5df88419d5b.tar.gz nextcloud-server-9cfbf7ed1c92b262984488eaa9cee5df88419d5b.zip |
Fix SVG icons
FIXME: Ugly hack to prevent SVG of being returned if the SVG
provider is not enabled.
This is required because the preview system is designed in a
bad way and relies on opt-in with asterisks (i.e. image/*)
which will lead to the fact that a SVG will also match the image
provider.
Conflicts:
lib/private/preview.php
Diffstat (limited to 'lib/private/preview.php')
-rwxr-xr-x | lib/private/preview.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/private/preview.php b/lib/private/preview.php index e9bfb3b9285..00f18219531 100755 --- a/lib/private/preview.php +++ b/lib/private/preview.php @@ -814,8 +814,19 @@ class Preview { self::initProviders(); } - foreach (self::$providers as $supportedMimeType => $provider) { - if (preg_match($supportedMimeType, $mimeType)) { + // FIXME: Ugly hack to prevent SVG of being returned if the SVG + // provider is not enabled. + // This is required because the preview system is designed in a + // bad way and relies on opt-in with asterisks (i.e. image/*) + // which will lead to the fact that a SVG will also match the image + // provider. + if($mimeType === 'image/svg+xml' && !array_key_exists('/image\/svg\+xml/', self::$providers)) { + return false; + } + + //remove last element because it has the mimetype * + foreach(self::$providers as $supportedMimetype => $provider) { + if(preg_match($supportedMimetype, $mimeType)) { return true; } } |