Skip to content

Commit

Permalink
Fix problem when creating shares that point to a version file instead…
Browse files Browse the repository at this point in the history
… of version folder
  • Loading branch information
Hugo Gonzalez Labrador committed Jul 31, 2015
1 parent 06575f7 commit 8dd116b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/private/files/objectstore/eosutil.php
Original file line number Diff line number Diff line change
Expand Up @@ -727,12 +727,19 @@ public static function getVersionsFolderIDFromFileID($id) {
// so we need to check carefuly
$eos_version_regex = \OCP\Config::getSystemValue("eos_version_regex");
// if file is already version folder we return that inode
if (preg_match("|".$eos_version_regex."|", $meta["eospath"]) ) {
if (preg_match("|".$eos_version_regex."|", basename($meta["eospath"])) ) {
return $meta['fileid'];
} else {
$dirname = dirname($meta['eospath']);
$basename = basename($meta['eospath']);
// We need to handle the case where the file is already a version.
// In that case the version folder is the parent.
$versionFolder = $dirname . "/.sys.v#." . $basename;
if (preg_match("|".$eos_version_regex."|", $dirname) ) {
$versionFolder = $dirname;
}


$versionInfo = \OC\Files\ObjectStore\EosUtil::getFileByEosPath($versionFolder);
if(!$versionInfo) {
self::createVersion($meta['eospath']);
Expand Down

0 comments on commit 8dd116b

Please sign in to comment.