-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add moveFromStorage for objectstorage to fix transfer ownership on s3 #32781
Conversation
Signed-off-by: unteem <[email protected]>
67eee25
to
5c41417
Compare
@@ -611,4 +611,17 @@ private function copyFile(ICacheEntry $sourceEntry, string $to) { | |||
throw $e; | |||
} | |||
} | |||
|
|||
public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { | |||
while ($sourceStorage->instanceOfStorage(Jail::class)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea if this is needed nor what it does.
It was in moveFromStorage function in Common.php and Local.php so I left it here
@@ -611,4 +611,17 @@ | |||
throw $e; | |||
} | |||
} | |||
|
|||
public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { | |||
while ($sourceStorage->instanceOfStorage(Jail::class)) { |
Check failure
Code scanning / Psalm
UndefinedClass
@@ -611,4 +611,17 @@ | |||
throw $e; | |||
} | |||
} | |||
|
|||
public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { | |||
while ($sourceStorage->instanceOfStorage(Jail::class)) { |
Check failure
Code scanning / Psalm
InvalidArgument
/** | ||
* @var Jail $sourceStorage | ||
*/ | ||
$sourceInternalPath = $sourceStorage->getUnjailedPath($sourceInternalPath); |
Check failure
Code scanning / Psalm
UndefinedDocblockClass
/** | ||
* @var Jail $sourceStorage | ||
*/ | ||
$sourceInternalPath = $sourceStorage->getUnjailedPath($sourceInternalPath); |
Check failure
Code scanning / Psalm
UndefinedDocblockClass
* @var Jail $sourceStorage | ||
*/ | ||
$sourceInternalPath = $sourceStorage->getUnjailedPath($sourceInternalPath); | ||
$sourceStorage = $sourceStorage->getUnjailedStorage(); |
Check failure
Code scanning / Psalm
UndefinedDocblockClass
@icewind1991 please validate this approach |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to check that the source storage is also an object store storage and uses the same underlying object store. If a file is moved from an external storage to the primary object store just moving the cache item isn't enough.
As there is no feedback since a while I will close this ticket. Thanks for the interest in Nextcloud and the effort put into this! 🙇 |
This PR fixes #25693 and #31870
When transferring ownership on s3 primary storage it was doing a copy and delete leading to shares being linked to non-existing files and failing to transfer
Implementing
moveFromStorage
inlib/private/Files/ObjectStore/ObjectStoreStorage.php
fixes it.It doesn't fix the
isSameStorage
(server/lib/private/Files/Storage/Common.php
Line 678 in e56a072
rename
which only works for renaming a folder/files in the same user storage.