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

Added support for path style in presigned Post #2835

Closed
wants to merge 3 commits into from

Conversation

RanVaknin
Copy link
Contributor

Following #2827

  1. The Go v2 SDK needed to add presigned-post support for path style URLs. The change to toBaseURL adds support for the following casing:
  • Checks if the input URL has a leading slash by inspecting the path segments. If so, it removes the leading empty segment.

  • Determines if the URL is "path-style" (bucket name in path) or "virtual-hosted" (bucket name in host) by checking the length of the path segments. If there are multiple segments, it's path-style; otherwise, it's virtual-hosted. The function then constructs the appropriate base URL accordingly.

This is a heuristic approach of parsing the URL and will not cover all of the edge cases and ways for users of the SDK to provide an custom endpoint that might not work accordingly.

  1. To solve this, I added a PresignPostOptions option called BaseURLOverride which will let users directly override the URL that the presigner uses.

  2. Added test cases for both additions.

@RanVaknin
Copy link
Contributor Author

Should we rename the test function to "TestPresignPostObject" instead of "TestPresignPutObject"?

@lucix-aws lucix-aws closed this Oct 18, 2024
@lucix-aws
Copy link
Contributor

#2842

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants