Nextcloud prevent confusion by using /run/ instead of /app/ in routes #96

This commit is contained in:
the-djmaze 2022-10-12 10:18:52 +02:00
parent cf8cdc25c3
commit 5ce11ce3dd
2 changed files with 3 additions and 10 deletions

View file

@ -9,12 +9,12 @@ return [
], ],
[ [
'name' => 'page#appGet', 'name' => 'page#appGet',
'url' => '/app/', 'url' => '/run/',
'verb' => 'GET' 'verb' => 'GET'
], ],
[ [
'name' => 'page#appPost', 'name' => 'page#appPost',
'url' => '/app/', 'url' => '/run/',
'verb' => 'POST' 'verb' => 'POST'
], ],
[ [

View file

@ -86,14 +86,7 @@ class SnappyMailHelper
*/ */
public static function getAppUrl() public static function getAppUrl()
{ {
$sRequestUri = \OC::$server->getURLGenerator()->linkToRoute('snappymail.page.appGet'); return \OC::$server->getURLGenerator()->linkToRoute('snappymail.page.appGet');
if ($sRequestUri) {
return $sRequestUri;
}
$sRequestUri = empty($_SERVER['REQUEST_URI']) ? '': \trim($_SERVER['REQUEST_URI']);
$sRequestUri = \preg_replace('/index.php\/.+$/', 'index.php/', $sRequestUri);
$sRequestUri = $sRequestUri.'apps/snappymail/app/';
return '/'.\ltrim($sRequestUri, '/\\');
} }
/** /**