Skip to content

Commit

Permalink
fix(versions): Fix strict trimming of version paths
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and backportbot[bot] committed Sep 12, 2024
1 parent de3a4cb commit 43966c2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ protected function translatePath(IStorage $storage, string $path): string {
[$folder, $innerPath] = explode('/', $path, 2);

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

0 comments on commit 43966c2

Please sign in to comment.