nextcloud/tests/lib/Files/Storage
Louis Chemineau 2e3cffa473 fix: Transfer ownership with S3 as primary
When using S3 as primary storage, transferring ownership with the `--move` option fail with the following error:

`SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '8-45b963397aa40d4a0063e0d85e4fe7a1' for key 'fs_storage_path_hash'`

The `--move` option moves the entire home folder from one account to another.
The error means that the move failed because the destination folder already exist in `oc_filecache`.

- With S3 as primary storage, folders only exists as entries in `oc_filecache`.
- With S3 as primary storage, `moveFromStorage(...)` only moves the cache entry, as nothing needs to be moved on disk. This cache move does not delete potentially pre-existing destination folder.
- With Local storage, `moveFromStorage(...)` calls `rename(...)` which delete pre-existing folder.

- `transfer(...)`: 687a4d9ac7/apps/files/lib/Service/OwnershipTransferService.php (L112)
- `oneTimeUserSetup(...)`: 687a4d9ac7/lib/private/Files/SetupManager.php (L261-L262)
- `mkdir(...)`: 687a4d9ac7/lib/private/Files/ObjectStore/ObjectStoreStorage.php (L91-L135)
- `moveFromStorage(...)`: 687a4d9ac7/lib/private/Files/ObjectStore/ObjectStoreStorage.php (L635-L636)

Delete pre-existing folder in `moveFromStorage(...)`

Signed-off-by: Louis Chemineau <louis@chmn.me>
2025-04-14 14:14:58 +00:00
..
Wrapper fix(files): Do not array access null value 2025-01-29 10:28:01 +00:00
CommonTest.php fix: Enforce forbidden filename characters on backend 2024-02-28 22:19:25 +01:00
CopyDirectoryTest.php Format control structures, classes, methods and function 2020-04-10 14:19:56 +02:00
HomeTest.php Use the short array syntax, everywhere 2020-03-26 16:34:56 +01:00
LocalTest.php test: add test for nested jail cross-storage move 2024-10-29 10:41:24 +00:00
Storage.php fix: Clean-up some remaining readdir calls with undesirable false evaluation potential 2024-11-13 08:34:23 +05:30
StorageFactoryTest.php Some php-cs fixes 2019-11-22 20:52:10 +01:00
StoragesTest.php fix: Transfer ownership with S3 as primary 2025-04-14 14:14:58 +00:00