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

Commit

Permalink
Fix content filter
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Jun 9, 2016
1 parent 3837131 commit 39a87aa
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions core/src/plugins/core.access/src/AJXP_MetaStreamWrapper.php
Expand Up @@ -142,11 +142,13 @@ protected static function getNextScheme($url, $context='core'){
* @throws \Exception
*/
protected static function translateScheme($url, $crtInstance = null){
$parts=parse_url($url);
$currentScheme = $parts['scheme'];
$context = self::actualRepositoryWrapperProtocol(new AJXP_Node($url));
$newScheme = self::getNextScheme($url, $context);
$repository = RepositoryService::getRepositoryById(parse_url($url, PHP_URL_HOST));

$node = new AJXP_Node($url);
$currentScheme = $node->getScheme();
$context = self::actualRepositoryWrapperProtocol($node);
$newScheme = self::getNextScheme($url, $context);
$repository = $node->getRepository();

if($currentScheme == "pydio" && $repository->hasContentFilter()){

$contentFilter = $repository->getContentFilter();
Expand All @@ -159,13 +161,15 @@ protected static function translateScheme($url, $crtInstance = null){
}

if (!empty($baseDir) || $baseDir != "/") {
$crtPath = parse_url($url, PHP_URL_PATH);
$crtPath = $node->getPath();
if(empty($crtPath)){
$crtPath = "/";
}
$crtBase = basename($crtPath);
if (!empty($crtPath) && $crtPath != "/" && $crtBase != $contentFilter->getUniquePath() && $crtBase != ".ajxp_meta") {
throw new \Exception("Cannot find file " . $crtBase);
}
// Prepend baseDir in path
$url = str_replace($currentScheme . "://" . $repository->getId() . $crtPath, $currentScheme . "://" . $repository->getId() . rtrim($baseDir . $crtPath, "/"), $url);
$url = $node->getContext()->getUrlBase().rtrim($baseDir.$crtPath, "/");
}
}
}
Expand Down

0 comments on commit 39a87aa

Please sign in to comment.