Skip to content

Commit 5f54414

Browse files
committed
fix(versions): Fix strict trimming of version paths
Signed-off-by: Joas Schilling <[email protected]>
1 parent 8a00d35 commit 5f54414

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Operation.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ protected function translatePath(IStorage $storage, string $path): string {
134134
[$folder, $innerPath] = explode('/', $path, 2);
135135

136136
if ($folder === 'files_versions') {
137-
$innerPath = substr($innerPath, 0, strrpos($innerPath, '.v'));
137+
if (preg_match('/.+\.v\d{10}$/', basename($innerPath))) {
138+
// Remove trailing ".v{timestamp}"
139+
$innerPath = substr($innerPath, 0, -12);
140+
}
138141
return 'files/' . $innerPath;
139142
} elseif ($folder === 'thumbnails') {
140143
[$fileId,] = explode('/', $innerPath, 2);

0 commit comments

Comments
 (0)