]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix UrlGenerator::imagePath() for app paths
authorRobin McCorkell <rmccorkell@karoshi.org.uk>
Fri, 3 Apr 2015 22:42:18 +0000 (23:42 +0100)
committerRobin McCorkell <rmccorkell@karoshi.org.uk>
Fri, 3 Apr 2015 22:42:18 +0000 (23:42 +0100)
lib/private/urlgenerator.php

index f090dd51b6efc1ee26a32bcfa5cce95eeeeeb913..104cf7df596d552b23c5c00388f2432eaba8e7ed 100644 (file)
@@ -149,6 +149,8 @@ class URLGenerator implements IURLGenerator {
                //if a theme has a png but not an svg always use the png
                $basename = substr(basename($image),0,-4);
 
+               $appPath = \OC_App::getAppPath($app);
+
                // Check if the app is in the app folder
                $path = '';
                if (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) {
@@ -156,11 +158,11 @@ class URLGenerator implements IURLGenerator {
                } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.svg")
                        && file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.png")) {
                        $path =  \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$basename.png";
-               } elseif (file_exists(\OC_App::getAppPath($app) . "/img/$image")) {
+               } elseif ($appPath && file_exists($appPath . "/img/$image")) {
                        $path =  \OC_App::getAppWebPath($app) . "/img/$image";
-               } elseif (!file_exists(\OC_App::getAppPath($app) . "/img/$basename.svg")
-                       && file_exists(\OC_App::getAppPath($app) . "/img/$basename.png")) {
-                       $path =  \OC_App::getAppPath($app) . "/img/$basename.png";
+               } elseif ($appPath && !file_exists($appPath . "/img/$basename.svg")
+                       && file_exists($appPath . "/img/$basename.png")) {
+                       $path =  \OC_App::getAppWebPath($app) . "/img/$basename.png";
                } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$image")) {
                        $path =  \OC::$WEBROOT . "/themes/$theme/$app/img/$image";
                } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.svg")