feat(ExternalStorage) Allow the use of 'prefix' in S3 buckets#61585
feat(ExternalStorage) Allow the use of 'prefix' in S3 buckets#61585mbartsch wants to merge 2 commits into
Conversation
6a2538d to
7e55e24
Compare
|
Thank you for your pull request! Also you need to use conventional commit messages (e.g. |
|
Hope now is OK, if not, please let me know. |
b426fe4 to
cc7a490
Compare
Signed-off-by: Marcelo H. Bartsch <marcelo@bartsch.cl> Signed-off-by: Carl Schwan <carlschwan@kde.org>
cc7a490 to
c5e4cce
Compare
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
| if ($path !== null) { | ||
| $params['Prefix'] = $path . '/'; | ||
| $params['Prefix'] = $this->addPrefix($path . '/'); | ||
| } elseif ($this->prefix !== '') { | ||
| $params['Prefix'] = $this->prefix; |
There was a problem hiding this comment.
This can be simplified by doing $path = $this->addPrefix($path . '/'); above the if
Summary
Adds an optional Object key prefix parameter to the S3-Compatible Object Storage external storage backend.
This allows scoping a mount to a sub-path within a shared bucket rather than requiring exclusive use of the entire bucket. For example, setting the
prefix to nextcloud/$user/ will store each user's files under their own namespace within the bucket, with $user being substituted automatically at
mount time.
What changed:
transparently to all S3 key operations (read, write, delete, list, copy, presigned URLs). Keys returned from S3 listing responses have the prefix
stripped before being stored in the in-memory cache or yielded as directory entries. The storage ID includes the prefix so two mounts to the same
bucket with different prefixes are treated as distinct storages.
Variable substitution: $user (and any other registered placeholder) works in the prefix field automatically, since all backend options pass through
the existing applyConfigHandlers() pipeline before the storage is constructed.
TODO
Checklist
(https://docs.nextcloud.com/server/latest/developer_manual/app_development/tutorial.html#integration-tests), api and/or acceptance) are included
AI (if applicable)
Assisted-by: CloudeCode:claude-sonnet-4-6