Permalink
Browse files

Fix content filter

  • Loading branch information...
1 parent 3837131 commit 39a87aa6bb4d018b6d9efb7238fede4ea65d6c54 @cdujeu cdujeu committed Jun 9, 2016
Showing with 12 additions and 8 deletions.
  1. +12 −8 core/src/plugins/core.access/src/AJXP_MetaStreamWrapper.php
@@ -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();
@@ -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, "/");
}
}
}

0 comments on commit 39a87aa

Please sign in to comment.