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 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
..
AppData Change PHPDoc type hint from PHPUnit_Framework_MockObject_MockObject to \PHPUnit\Framework\MockObject\MockObject 2020-08-12 13:55:19 +02:00
Cache fix: Metadata field search 2025-01-27 13:03:49 +01:00
Config fix(users): Don't crash if disabled user is missing in the database 2024-09-23 18:08:17 +02:00
Mount test: add test for cache mount provider 2023-09-20 15:42:23 +02:00
Node fix(tests): Fix Folder tests 2024-09-19 17:51:51 +02:00
ObjectStore fix(tests): Fix most obvious errors in ObjectStore tests 2024-10-31 14:40:37 +01:00
Search test: Additional tests for issue #35776 2024-03-04 14:25:52 +01:00
SimpleFS Fix tests 2022-10-14 16:18:40 +02:00
Storage fix: Transfer ownership with S3 as primary 2025-04-14 14:14:58 +00:00
Stream fix(users): Don't crash if disabled user is missing in the database 2024-09-23 18:08:17 +02:00
Type fix: make sure we process mime extensions as string 2025-03-04 09:29:12 +01:00
Utils Migrate from ILogger to LoggerInterface where needed in the tests 2022-03-24 16:21:26 +01:00
EtagTest.php chore: apply changes from Nextcloud coding standards 1.1.1 2023-11-23 10:36:13 +01:00
FileInfoTest.php optimize isShared and isMounted 2023-11-08 17:34:58 +01:00
FilesystemTest.php chore: apply changes from Nextcloud coding standards 1.1.1 2023-11-23 10:36:13 +01:00
PathVerificationTest.php composer run cs:fix 2023-01-20 11:45:08 +01:00
ViewTest.php test(View): Copy preserves content 2025-02-13 23:37:04 +00:00