Skip to content

Commit

Permalink
Construct path to the version file from the current directory and fil…
Browse files Browse the repository at this point in the history
…ename. Fixes #22450
  • Loading branch information
VicDeo authored and Vincent Petry committed Jun 2, 2016
1 parent 3ff2bec commit d82df7e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions apps/files_versions/lib/Storage.php
Expand Up @@ -531,13 +531,15 @@ private static function getAllVersions($uid) {
$files = $view->getDirectoryContent($dir);

foreach ($files as $file) {
$fileData = $file->getData();
$filePath = $dir . '/' . $fileData['name'];
if ($file['type'] === 'dir') {
array_push($dirs, $file['path']);
array_push($dirs, $filePath);
} else {
$versionsBegin = strrpos($file['path'], '.v');
$versionsBegin = strrpos($filePath, '.v');
$relPathStart = strlen(self::VERSIONS_ROOT);
$version = substr($file['path'], $versionsBegin + 2);
$relpath = substr($file['path'], $relPathStart, $versionsBegin - $relPathStart);
$version = substr($filePath, $versionsBegin + 2);
$relpath = substr($filePath, $relPathStart, $versionsBegin - $relPathStart);
$key = $version . '#' . $relpath;
$versions[$key] = array('path' => $relpath, 'timestamp' => $version);
}
Expand Down

0 comments on commit d82df7e

Please sign in to comment.