Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-10-16 14:13:16 +0400
committerLukas Reschke <lukas@owncloud.com>2014-10-16 14:31:40 +0400
commit6d81789a6693ce2fcd127218a9dda9983362be8d (patch)
treec3308f99b731a6ce9ff4bdbe3a9d8fc4ca4916f7 /lib/private/preview.php
parente1e501b17f6d4dd2c13d2b6c36d26d2f7f7c1112 (diff)
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-xlib/private/preview.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/private/preview.php b/lib/private/preview.php
index 6953f639bcc..1e8c2ebaee9 100755
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -776,8 +776,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;
}
}