Fix presigned_url to read virtual_host and bucket_as_host from config #313
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves: #306
Problem
When
virtual_hostandbucket_as_hostare set in the ExAws configuration, thepresigned_urlandpresigned_postfunctions ignore these settings and default tofalse. This causes bucket names to appear twice in generated URLs when using custom domain buckets.Example issue:
virtual_host: true, bucket_as_host: truehttps://my-bucket.com/my-bucket.com/path/to/filehttps://my-bucket.com/path/to/fileThis breaks multipart uploads and other S3 operations when using custom domains.
Root Cause
The
presigned_urlandpresigned_postfunctions were hardcoded to default tofalse:Solution
Modified both functions to use config values as defaults while still allowing explicit options to override them:
Changes
presigned_url/5: Now readsvirtual_hostandbucket_as_hostfrom config as defaultspresigned_post/4: Now readsvirtual_hostandbucket_as_hostfrom config as defaultsTesting
bucket_as_host=trueRelated
bucket_as_host#306This fix ensures that presigned URLs work correctly with custom domain buckets when
bucket_as_host=trueis set in the ExAws configuration.