0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-05-02 13:00:42 +00:00
nextcloud_server/tests/lib/Files
Louis Chemineau 27ed921ad5 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-16 10:19:17 +02:00
..
AppData refactor: Add void return type to PHPUnit test methods 2024-09-15 22:32:31 +02:00
Cache fix: Metadata field search 2025-01-25 09:44:50 +00:00
Config test: update test for mountpoint numeric storage id 2025-01-13 18:09:29 +01:00
Mount refactor(Storage): Make all parameter types strong types 2024-10-07 15:00:05 +02:00
Node test: put parent items into cache in tests 2024-09-18 16:10:14 +02:00
ObjectStore fix: Harden files scanner for invalid null access 2025-01-28 19:49:03 +00:00
Search refactor: Add void return type to PHPUnit test methods 2024-09-15 22:32:31 +02:00
SimpleFS refactor: Add void return type to PHPUnit test methods 2024-09-15 22:32:31 +02:00
Storage fix: Transfer ownership with S3 as primary 2025-04-16 10:19:17 +02:00
Stream refactor(Stream\Encryption): Migrate to strong types 2024-10-07 14:02:27 +02:00
Type fix: make sure we process mime extensions as string 2025-02-09 21:09:12 +01:00
Utils refactor: Add void return type to PHPUnit test methods 2024-09-15 22:32:31 +02:00
EtagTest.php refactor: Add void return type to PHPUnit test methods 2024-09-15 22:32:31 +02:00
FileInfoTest.php refactor: Add void return type to PHPUnit test methods 2024-09-15 22:32:31 +02:00
FilenameValidatorTest.php fix(IFilenameValidator): correctly handle case insensitivity 2025-03-28 20:54:23 +01:00
FilesystemTest.php refactor: Add void return type to PHPUnit test methods 2024-09-15 22:32:31 +02:00
PathVerificationTest.php refactor: Add void return type to PHPUnit test methods 2024-09-15 22:32:31 +02:00
ViewTest.php fix: improve checks for moving shares/storages into other mounts 2025-01-03 15:36:32 +01:00