Skip to content

Commit

Permalink
Change required for move operation
Browse files Browse the repository at this point in the history
This change is required so that move
operation executed by transer-ownership
command.

Signed-off-by: Sujith H <sharidasan@owncloud.com>
  • Loading branch information
sharidas committed Jul 27, 2017
1 parent cdadf2e commit fead3cb
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/Crypto/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,23 @@ public function begin($path, $user, $mode, array $header, array $accessList) {
// always use the version from the original file, also part files
// need to have a correct version number if they get moved over to the
// final location
$this->version = (int)$this->keyManager->getVersion($this->stripPartFileExtension($path), new View());
if (\OC::$server->getSession()->exists('renameFile')) {
list($sourcePath,$targetPath) = \OC::$server->getSession()->get('renameFile');
/*
* Rename triggered. So if the path and targetpath are same use
* sourcepath's version number. Else use path's version, because that's
* sourcepath.
*/
if ( $path === $targetPath) {
$this->version = $this->keyManager->getVersion($sourcePath, new View());
} else {
$this->version = (int)$this->keyManager->getVersion($this->stripPartFileExtension($path), new View());
}
} else {
//If not rename then use path's current version.
$this->version = (int)$this->keyManager->getVersion($this->stripPartFileExtension($path), new View());
}


if (
$mode === 'w'
Expand Down

0 comments on commit fead3cb

Please sign in to comment.