Skip to content
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

Rename/copy doesn't preserve versions #13

Closed
PVince81 opened this issue Oct 12, 2021 · 4 comments
Closed

Rename/copy doesn't preserve versions #13

PVince81 opened this issue Oct 12, 2021 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@PVince81
Copy link
Member

PVince81 commented Oct 12, 2021

Steps

  1. docker run -p 9000:9000 minio/minio server /data{1...12}
  2. Create a bucket nextcloud-dev in the Minio console
  3. Enable versioning for that bucket
  4. occ app:enable files_external
  5. occ app:enable files_versions_s3
  6. Setup that minio thing as external storage
  7. Create a folder "test/sub"
  8. Upload multiple versions of a single file "test.md" (or use the text editor, but beware of Text editor keeps on detecting non-existing conflicts on external storage text#1896)
  9. Check the versions list of "test/sub/test.md" and see that multiple versions exist there
  10. Rename "test" to "test_renamed"
  11. Check again the versions list of "test_renamed/sub/test.md"

Expected result

Versions are preserved like for other storages.

Actual result

Versions not preserved.

Versions

Nextcloud 23 git master 4a1a9d6821fa61885080793ab34cdb9f4d2d0057

Notes

Unrelated to #11 but they both use the copy routine.
It's the copy that should somehow copy the versions as well if possible.
I hope the S3 API allows for that, otherwise we'll need to recurse there.

@PVince81 PVince81 added the bug Something isn't working label Oct 12, 2021
@PVince81
Copy link
Member Author

as far as I could understand in https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html the copy would just be like another version, which implies that copying the object itself doesn't preserve versions

this means we'll need to copy all versions individually.

it seems that the AWS PHP SDK doesn't have a batch method for copying multiple objects, only deleteObjects.

@PVince81 PVince81 self-assigned this Oct 12, 2021
@PVince81
Copy link
Member Author

PVince81 commented Oct 12, 2021

I've tested with CopyObject and while the versions are copied over:

  • it seems their order changes
  • it's not possible to preserve LastModified, they get a new value: https://stackoverflow.com/a/13981403
  • the version ids change
  • the new versions cannot be downloaded through Nextcloud for some reason, the version ids match the UI though

Draft PR here: nextcloud/server#29179

@PVince81
Copy link
Member Author

For LastModified, we might be able to introduce a custom extra metadata attribute that we set on copy.
If it's not set, fall back to LastModified when returning the versions.

@PVince81
Copy link
Member Author

PVince81 commented Nov 2, 2021

by design for now

versions will be preserved in the original location by S3 itself: nextcloud/server#29220

@PVince81 PVince81 closed this as completed Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant