diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bfeae8..045f434 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ # Changelog All notable changes to this project will be documented in this file. +## 1.20.1 – 2024-09-12 +### Fixed +- fix(versions): Fix compatibility with files_versions and PHP strict types + ## 1.20.0 – 2024-07-30 ### Changed - Require Nextcloud 30 diff --git a/lib/Operation.php b/lib/Operation.php index ce4cf35..1fa523a 100644 --- a/lib/Operation.php +++ b/lib/Operation.php @@ -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); diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index b6b2f69..b17e249 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -18,9 +18,6 @@ - - -