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

s3 head object, erroneously modified object name #2982

Open
2 of 3 tasks
luoyanpeng-bytedancer opened this issue Jan 23, 2025 · 2 comments
Open
2 of 3 tasks

s3 head object, erroneously modified object name #2982

luoyanpeng-bytedancer opened this issue Jan 23, 2025 · 2 comments
Assignees
Labels
bug This issue is a bug. needs-review This issue or pull request needs review from a core team member. p3 This is a minor priority issue

Comments

@luoyanpeng-bytedancer
Copy link

Acknowledgements

Describe the bug

s3 head object:If the object name starts with"/+ bucket name", the SDK will remove the bucket name from the object name in the path of the URL, causing the request to return 404.

code :
[email protected] internal/customizations/update_endpoint.go
func moveBucketNameToHost(u *url.URL, bucket string) { u.Host = bucket + "." + u.Host removeBucketFromPath(u, bucket) }

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Object names should not be modified

Current Behavior

If the object name starts with"/+ bucket name", the SDK will remove the bucket name from the object name in the path of the URL

Reproduction Steps

Head An object prefixed with "/+ bucket name"

Possible Solution

No response

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go-v2 v1.33.0
github.com/aws/aws-sdk-go-v2/config v1.5.0
github.com/aws/aws-sdk-go-v2/service/s3 v1.73.2
github.com/aws/smithy-go v1.22.1

Compiler and Version used

go version go1.21.7 darwin/amd64

Operating System and version

macOS 14.0 (23A344)

@luoyanpeng-bytedancer luoyanpeng-bytedancer added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 23, 2025
@adev-code adev-code self-assigned this Jan 27, 2025
@adev-code adev-code added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Jan 27, 2025
@adev-code
Copy link

Hello @luoyanpeng-bytedancer, thanks for reaching out. For doing head object operations on S3 key names that contains characters such as "/" and "+", you would need to encode those characters as they are identified as special characters for S3 (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html). So for the request, it would need to have the encoded version of the characters. If you have any questions, please do let me know. Thanks.

@adev-code adev-code added p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Jan 29, 2025
@luoyanpeng-bytedancer
Copy link
Author

Hello @luoyanpeng-bytedancer, thanks for reaching out. For doing head object operations on S3 key names that contains characters such as "/" and "+", you would need to encode those characters as they are identified as special characters for S3 (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html). So for the request, it would need to have the encoded version of the characters. If you have any questions, please do let me know. Thanks.

Why boto3 can not encode "/", and why only "/+ bucket name" has this problem

@adev-code adev-code added needs-review This issue or pull request needs review from a core team member. and removed response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-review This issue or pull request needs review from a core team member. p3 This is a minor priority issue
Projects
None yet
Development

No branches or pull requests

2 participants