Skip to content

Commit

Permalink
Merge pull request #596 from nextcloud/backport/595/stable30
Browse files Browse the repository at this point in the history
[stable30] fix(versions): Fix strict trimming of version paths
  • Loading branch information
nickvergessen authored Sep 12, 2024
2 parents de3a4cb + ffc3d2f commit b90cc3d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ An example would be to deny access to MS Excel/XLSX files owned by the "Human Re

Learn more about File Access Control on [https://nextcloud.com/workflow](https://nextcloud.com/workflow)</description>

<version>1.20.0</version>
<version>1.20.1</version>
<licence>agpl</licence>
<author>Arthur Schiwon</author>
<author>Joas Schilling</author>
Expand Down
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
3 changes: 0 additions & 3 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
<MissingDependency>
<code><![CDATA[StorageWrapper]]></code>
</MissingDependency>
<PossiblyFalseArgument>
<code><![CDATA[strrpos($innerPath, '.v')]]></code>
</PossiblyFalseArgument>
<PossiblyUndefinedArrayOffset>
<code><![CDATA[$innerPath]]></code>
</PossiblyUndefinedArrayOffset>
Expand Down

0 comments on commit b90cc3d

Please sign in to comment.