-
Notifications
You must be signed in to change notification settings - Fork 202
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
feat(Storage): Adding subpath strategy to the List operation #3775
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
// Upload data | ||
_ = try await Amplify.Storage.uploadData(path: .fromString(uniqueStringPath + "-test"), data: data, options: nil).value | ||
_ = try await Amplify.Storage.uploadData(path: .fromString(uniqueStringPath + "-subpath-test"), data: data, options: nil).value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens when the subpath is --subpath-test
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, the excluded subpath will be public/[UUID]--
From the S3 perspective, here's how it works. You have these objects:
public/[UUID]-test
public/[UUID]--subpath-test
You filter everything that starts with the prefix public/[UUID]-
, and both objects still match:
public/[UUID]-test public/[UUID]--subpath-test
But since you set the delimiter to -
, any object that contains it after the given prefix is gets rolled up until that character. So public/[UUID]--subpath-test
is rolled up to the public/[UUID]--
common prefix, because the -
character is the very next character after the prefix.
This value is then reported as an excludedSubpath
by Amplify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comment
Description
This PR introduces the
subpathStrategy
parameter toStorageListRequest.Options
and its correspondingSubpathStrategy
enum type.Using this field will affect the results included in the response:
subpathStrategy: .include
: Objects that are included in nested subpaths will be included in the response. This is the default behavioursubpathStrategy: .exclude
: Objects that are included in nested subpaths are not included in the response, instead their subpaths are included in theexcludedSubpaths
list.subpathStrategy: .exclude(delimitedBy:)
: Same as above, but it allows to set a custom character as delimiter for subpaths. The delimiter parameter defaults to"/"
, which is the same as.exclude
.General Checklist
Given When Then
inline code documentation and are named accordinglytestThing_condition_expectation()
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.