0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-05-06 23:10:43 +00:00
nextcloud_server/lib/private/Files/ObjectStore
Louis Chemineau 8fdf2a7eae 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-01 13:53:56 +02:00
..
AppdataPreviewObjectStoreStorage.php refactor(Storage): Align all Storage constructors 2024-10-23 13:24:18 +02:00
Azure.php refactor(Storage): Align all Storage constructors 2024-10-23 13:24:18 +02:00
HomeObjectStoreStorage.php refactor(Storage): Align all Storage constructors 2024-10-23 13:24:18 +02:00
Mapper.php chore: Add SPDX header 2024-05-24 13:11:22 +02:00
ObjectStoreScanner.php perf(files): faster query to fetch incomplete directories 2025-02-13 10:11:02 +01:00
ObjectStoreStorage.php fix: Transfer ownership with S3 as primary 2025-04-01 13:53:56 +02:00
S3.php feat: add command to list objects 2025-03-31 14:30:40 +02:00
S3ConfigTrait.php fix(S3ConfigTrait): Allow proxy field to take false 2024-09-15 15:41:58 +02:00
S3ConnectionTrait.php feat(object_store): Add support for session token in AWS credentials 2025-02-06 16:24:19 +01:00
S3ObjectTrait.php fix: don't perform the extra buffering in s3 stream write when the stream size is known 2024-12-05 14:07:40 +01:00
S3Signature.php chore(deps): Update nextcloud/coding-standard to v1.3.1 2024-09-19 14:21:20 +02:00
StorageObjectStore.php fix: fix object store id for test object store 2024-09-18 13:54:55 +02:00
Swift.php chore: Add SPDX header 2024-05-24 13:11:22 +02:00
SwiftFactory.php fix: make swift connect exception message more informative 2024-09-09 17:15:01 +02:00
SwiftV2CachingAuthService.php chore: Add SPDX header 2024-05-24 13:11:22 +02:00