Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Backporting changes in app_path detection
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-alain-b committed Mar 23, 2022
1 parent 4de6909 commit b078d1f
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions app/rainloop/v/1.16.0/app/libraries/RainLoop/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,10 @@ public static function WebPath()
$sAppPath = '';
if (\RainLoop\Utils::IsOwnCloud())
{
if (\class_exists('OC_App'))
{
$sAppPath = \rtrim(\trim(\OC_App::getAppWebPath('rainloop')), '\\/').'/app/';
}
$sAppPath = \OC::$server->getURLGenerator()->linkToRoute('rainloop.page.appGet');
// TODO: Fix this ugly hack. Is there a "modern" way to return
// a URL that doesn't include index.php, which breaks things?
$sAppPath = preg_replace('/index\.php\//', '', $sAppPath);

if (empty($sAppPath))
{
Expand All @@ -577,9 +577,18 @@ public static function WebPath()
}
}
}

return $sAppPath;
/*Now trying to detect the apps folder to give the right URL for assets */
$re = '/\/([a-zA-Z0-9-_\.]*)\/rainloop\/app\//m';
$str = __FILE__;
preg_match($re, $str, $matches);

if ($matches[1] == "apps") {
return $sAppPath;
} else {
return str_replace("/apps/rainloop/app", "/".$matches[1]."/rainloop/app", $sAppPath);
}
}

/**
* @return string
*/
Expand Down

0 comments on commit b078d1f

Please sign in to comment.