Permalink
Browse files

Fix cleanExpiredLinks

  • Loading branch information...
1 parent cfd28f2 commit 78b4900931f1b80a3dbb711895ebd5d6796031ee @cdujeu cdujeu committed Sep 12, 2016
@@ -870,8 +870,9 @@
}
static buildDirectDownloadUrl(node, publicLink, contentProvider = false){
- let ctString = contentProvider ? '&ct=true' : '';
- return publicLink + (publicLink.indexOf('?') !== -1 ? '&' : '?') + 'dl=true'+ ctString +'&file=/'+encodeURIComponent(node.getLabel());
+ let ctString = contentProvider ? '?ct=true' : '';
+ let link = publicLink.split('--').shift();
+ return link + (link.endsWith('/')? '' : '/') + 'dl/'+encodeURIComponent(node.getLabel()) + ctString;
}
static qrcodeEnabled(){
@@ -24,6 +24,7 @@
use Pydio\Core\Services\RepositoryService;
use Pydio\Share\Model\CompositeShare;
+use Pydio\Share\Model\ShareLink;
defined('AJXP_EXEC') or die('Access not allowed');
define('AJXP_SHARED_META_NAMESPACE', 'ajxp_shared');
@@ -175,6 +176,15 @@ protected function compositeShareFromMetaWithScope($node, $scope = "private"){
foreach($repoData["links"] as $link){
$composite->addLink($link);
}
+ if($composite->isInvalid()){
+ // Clear meta and skip
+ $this->removeShareFromMeta($node, $repoId);
+ /** @var ShareLink[] $link */
+ foreach ($repoData['links'] as $link){
+ $this->removeShareFromMeta($node, $link->getHash());
+ }
+ continue;
+ }
$composites[] = $composite;
}
return $composites;
@@ -737,12 +737,11 @@ public function clearExpiredFiles($currentUser = true)
*/
private function deleteExpiredPubliclet($elementId, $data){
- // TODO: REWRITE THIS FUNCTION
-
- if($this->context->hasUser() || $this->context->getUser()->getId() != $data["OWNER_ID"]){
-
+ /**
+ if(!$this->context->hasUser() || $this->context->getUser()->getId() !== $data["OWNER_ID"]){
AuthService::logUser($data["OWNER_ID"], "", true);
}
+ **/
$repoObject = $data["REPOSITORY"];
if(!($repoObject instanceof Repository)) {
$repoObject = RepositoryService::getRepositoryById($data["REPOSITORY"]);
@@ -758,19 +757,20 @@ private function deleteExpiredPubliclet($elementId, $data){
// Cannot load this repository anymore.
}
}
- if($repoLoaded && isSet($data["FILE_PATH"])){
- // @TODO : ADD USER IN URL
- $ajxpNode = new AJXP_Node("pydio://".$repoObject->getId().$data["FILE_PATH"]);
- }
- $this->deleteShare($data['SHARE_TYPE'], $elementId, false, true);
- if(isSet($ajxpNode)){
- try{
- $this->getMetaManager()->removeShareFromMeta($ajxpNode, $elementId);
- }catch (\Exception $e){
-
+ $ajxpNode = null;
+ if($repoLoaded && $repoObject->hasParent()){
+ if(isSet($data["FILE_PATH"])){
+ $filePath = $data["FILE_PATH"];
+ $ajxpNode = new AJXP_Node("pydio://".$data["OWNER_ID"]."@".$repoObject->getParentId().$filePath);
+ }else if($repoObject->hasContentFilter()){
+ $filePath = $data["FILE_PATH"] = $repoObject->getContentFilter()->getUniquePath();
+ $ajxpNode = new AJXP_Node("pydio://".$data["OWNER_ID"]."@".$repoObject->getParentId().'/'.$filePath);
}
- gc_collect_cycles();
}
+ Logger::debug("sharestore", "Delete share now !");
+ $this->deleteShare($data['SHARE_TYPE'], $elementId, false, true, $ajxpNode);
+
+ gc_collect_cycles();
}
@@ -79,7 +79,7 @@ protected function initTaskFromApi(ServerRequestInterface $request, Task &$task)
}
if(count($task->nodes)){
foreach($task->nodes as $index => $path){
- $task->nodes[$index] = "pydio://".$task->getWsId().$path;
+ $task->nodes[$index] = "pydio://".$task->getUserId()."@".$task->getWsId().$path;
}
}
}

0 comments on commit 78b4900

Please sign in to comment.