-
Notifications
You must be signed in to change notification settings - Fork 12
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 '.' in Bucket Name #84
Conversation
protected String getEndpoint(JsonObject parameters, String host) { | ||
if (parameters.has(KEY_BUCKET_NAME)) { | ||
String bucketName = parameters.get(KEY_BUCKET_NAME).getAsString().toLowerCase(); | ||
host = host.toLowerCase(Locale.ROOT).replace(bucketName, ""); |
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 concern butt I don't see the tolowercase used in the original getEndpointFromHost method. Is there an existing use case that has issues with cases?
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.
We are replacing bucket name from the host, if some client enters bucket name in different case as in the source uri. It won't be replaced properly.
* | ||
* @param parameters JsonObject containing ms.source.s3.parameters | ||
* @param host hostname with bucket name in the beginning | ||
* @return the endpoint name without the bucket name |
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.
nit: in the comment maybe add some details to explain its difference from getEndpointFromHost. That will help with debugging in the future
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.
Sure, I will add
new Gson().fromJson("{\"region\" : \"us-east-2\", \"bucket_name\" : \"colleCt-us-west-2.tealium.com\"}", | ||
JsonObject.class); | ||
String host = "collect-us-west-2.tealium.com.s3.amazonaws.com"; | ||
String endpoint = s3SourceV2.getEndpoint(parameteres, host); |
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.
nit: parameteres -> parameters
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.
Sure with fix the typo.
Dear DIL maintainers,
Please accept this PR. I understand that it will not be reviewed until I have checked off all the steps below!
JIRA
Description
So added a new parameter in ms.source.s3.parameters for bucket name as "bucket_name" which would help to navigate through the edge cases.
Tests
Commits