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

Support non-slash-ending prefixes in S3 Transfer #1721

Open
alex-at-cascade opened this issue Feb 4, 2019 · 2 comments
Open

Support non-slash-ending prefixes in S3 Transfer #1721

alex-at-cascade opened this issue Feb 4, 2019 · 2 comments
Labels
feature-request A feature should be added or improved. needs-major-version Can only be considered for the next major release no-autoclose This issue should not be auto-closed by stale-issue-cleanup action. p3 This is a minor priority issue

Comments

@alex-at-cascade
Copy link

This code:

. (isset($parts['Key']) ? $parts['Key'] . '/' : '');

assumes that the S3 key prefix will be a full "path like component" for downloads, and forces it to end in a slash. However, in our use case the prefix is just the common starting part of the name for several objects that we want to download all at once. (We're encountering this as we update some old code from sdk v2 to sdk v3.)

@diehlaws diehlaws self-assigned this Feb 4, 2019
@diehlaws diehlaws added guidance Question that needs advice or information. feature-request A feature should be added or improved. labels Feb 4, 2019
@diehlaws
Copy link
Contributor

diehlaws commented Feb 4, 2019

Hi @alex-at-cascade, thanks for reaching out to us. The S3 Transfer Manager in the AWS SDK for PHP is used to upload entire directories to an Amazon S3 bucket and download entire buckets/directories to a local directory. Unfortunately your suggestion would be a breaking change for the SDK so we will not be implementing it for the current major version.

If the objects you are looking to download exist within the same S3 prefix in your Bucket you can instead issue a ListObjects call with the string matching the common starting portion of the file names as the 'Prefix' parameter for the call, and iterate through the 'Contents' portion of its response to download the desired objects from S3.

@diehlaws diehlaws added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Feb 4, 2019
@alex-at-cascade
Copy link
Author

Thanks for your response and suggestions. I understand that's a very common use case, to download entire "directories", assuming slash as a path separator. (Although, to be honest, I couldn't find any documentation of that limitation. I had been assuming normal S3 conventions, as is also followed by V2 of the SDK.) It's very close to being able to support everything the standard S3 API can, other than the extraneous assumed path separator. Just curious, would it be feasible to add an option in the $options array to leave the prefix as just a prefix (without mangling it)?

@diehlaws diehlaws removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Feb 20, 2019
@diehlaws diehlaws removed their assignment Aug 26, 2020
@howardlopez howardlopez added the no-autoclose This issue should not be auto-closed by stale-issue-cleanup action. label Aug 27, 2020
@stobrien89 stobrien89 removed the guidance Question that needs advice or information. label Apr 9, 2022
@yenfryherrerafeliz yenfryherrerafeliz added the needs-major-version Can only be considered for the next major release label Jun 10, 2022
@yenfryherrerafeliz yenfryherrerafeliz added the p3 This is a minor priority issue label Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. needs-major-version Can only be considered for the next major release no-autoclose This issue should not be auto-closed by stale-issue-cleanup action. p3 This is a minor priority issue
Projects
None yet
Development

No branches or pull requests

5 participants