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

Commit

Permalink
Refix detectServerUrl() in REST case.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Sep 24, 2016
1 parent 5aa4d8f commit 4709f18
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions core/src/core/src/pydio/Core/Utils/ApplicationState.php
Expand Up @@ -22,6 +22,7 @@

use Pydio\Core\Model\RepositoryInterface;
use Pydio\Core\Services\ConfService;
use Pydio\Core\Utils\Vars\PathUtils;
use Pydio\Log\Core\Logger;

defined('AJXP_EXEC') or die('Access not allowed');
Expand Down Expand Up @@ -195,15 +196,11 @@ public static function detectServerURL($withURI = false, $forceInternal = false)
return "$protocol://$name$port";
} else {
$uri = dirname($_SERVER["REQUEST_URI"]);
$api = self::getSapiRestBase();
if (!empty($api)) {
$api .= '/';
if(strpos($uri, $api) === 0){
$uri = '/';
}else{
// Keep only before api base
$uri = array_shift(explode($api, $uri));
}
$apiBase = self::getSapiRestBase();
if (!empty($apiBase)) {
// apiBase must be /path/to/pydio/endpoint => remove endpoint
$uri = PathUtils::forwardSlashDirname(rtrim($apiBase));
if(empty($uri)) $uri = "/";
}
return "$protocol://$name$port" . $uri;
}
Expand Down

0 comments on commit 4709f18

Please sign in to comment.