From f5d83e85b7c3ed52440750888439c257c94c4854 Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Tue, 17 May 2016 17:27:33 +0300 Subject: [PATCH] Construct path to the version file from the current directory and filename. Fixes #22450 --- apps/files_versions/lib/storage.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php index 3c23f2f730..a1069410e7 100644 --- a/apps/files_versions/lib/storage.php +++ b/apps/files_versions/lib/storage.php @@ -532,13 +532,15 @@ class Storage { $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); }