Skip to content
Snippets Groups Projects
Commit e512a69a authored by Vincent Petry's avatar Vincent Petry
Browse files

Merge pull request #15395 from owncloud/fix-imagepath

Fix UrlGenerator::imagePath() for app paths
parents 7b2d5360 fbb84a51
No related branches found
No related tags found
No related merge requests found
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment