Skip to content

Commit 645d17d

Browse files
authored
Merge pull request #4309 from nextcloud/artonge/fix/version_storage_check
fix(versions): Check the class of the file's storage instead of the mountpoint
2 parents bb316a2 + aacab2d commit 645d17d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/Versions/VersionsBackend.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function getVersionsForFile(IUser $user, FileInfo $file): array {
148148
private function getVersionsForFileFromDB(FileInfo $fileInfo, IUser $user): array {
149149
$folder = $this->getFolderForFile($fileInfo);
150150
$mountPoint = $fileInfo->getMountPoint();
151-
if (!$mountPoint instanceof GroupMountPoint) {
151+
if (!$fileInfo->getStorage()->instanceOfStorage(GroupFolderStorage::class)) {
152152
return [];
153153
}
154154
$versionsFolder = $this->getVersionFolderForFile($fileInfo);
@@ -328,9 +328,8 @@ public function deleteVersion(IVersion $version): void {
328328
}
329329

330330
$sourceFile = $version->getSourceFile();
331-
$mount = $sourceFile->getMountPoint();
332331

333-
if (!($mount instanceof GroupMountPoint)) {
332+
if (!$sourceFile->getStorage()->instanceOfStorage(GroupFolderStorage::class)) {
334333
return;
335334
}
336335

@@ -399,8 +398,7 @@ private function currentUserHasPermissions(FileInfo $sourceFile, int $permission
399398
* @psalm-suppress MethodSignatureMismatch - The signature of the method is correct, but psalm somehow can't understand it
400399
*/
401400
public function importVersionsForFile(IUser $user, Node $source, Node $target, array $versions): void {
402-
$mount = $target->getMountPoint();
403-
if (!($mount instanceof GroupMountPoint)) {
401+
if (!$target->getStorage()->instanceOfStorage(GroupFolderStorage::class)) {
404402
return;
405403
}
406404

0 commit comments

Comments
 (0)