Skip to content

Commit

Permalink
Move copy- and moveFromStorage to jail
Browse files Browse the repository at this point in the history
  • Loading branch information
rullzer committed Apr 19, 2016
1 parent 2f1c62c commit f27d7cb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
20 changes: 0 additions & 20 deletions apps/files_sharing/lib/sharedstorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,24 +415,4 @@ public function getSourceStorage() {
return $this->sourceStorage;
}

/**
* @param \OCP\Files\Storage $sourceStorage
* @param string $sourceInternalPath
* @param string $targetInternalPath
* @return bool
*/
public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
return parent::copyFromStorage($sourceStorage, $sourceInternalPath, $this->getSourcePath($targetInternalPath));
}

/**
* @param \OCP\Files\Storage $sourceStorage
* @param string $sourceInternalPath
* @param string $targetInternalPath
* @return bool
*/
public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
return parent::moveFromStorage($sourceStorage, $sourceInternalPath, $this->getSourcePath($targetInternalPath));
}

}
26 changes: 26 additions & 0 deletions lib/private/files/storage/wrapper/jail.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,4 +460,30 @@ public function changeLock($path, $type, ILockingProvider $provider) {
public function resolvePath($path) {
return [$this->storage, $this->getSourcePath($path)];
}

/**
* @param \OCP\Files\Storage $sourceStorage
* @param string $sourceInternalPath
* @param string $targetInternalPath
* @return bool
*/
public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
if ($sourceStorage === $this) {
return $this->copy($sourceInternalPath, $targetInternalPath);
}
return $this->storage->copyFromStorage($sourceStorage, $sourceInternalPath, $this->getSourcePath($targetInternalPath));
}

/**
* @param \OCP\Files\Storage $sourceStorage
* @param string $sourceInternalPath
* @param string $targetInternalPath
* @return bool
*/
public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
if ($sourceStorage === $this) {
return $this->rename($sourceInternalPath, $targetInternalPath);
}
return $this->storage->moveFromStorage($sourceStorage, $sourceInternalPath, $this->getSourcePath($targetInternalPath));
}
}

0 comments on commit f27d7cb

Please sign in to comment.