tustvold commented on code in PR #3327:
URL: https://github.com/apache/arrow-rs/pull/3327#discussion_r1046051937
##########
object_store/src/aws/mod.rs:
##########
@@ -452,30 +466,40 @@ impl AmazonS3Builder {
/// .build();
/// ```
pub fn with_url(mut self, url: impl AsRef<str>) -> Self {
- if let Ok(parsed) = Url::parse(url.as_ref()) {
- match parsed.scheme() {
+ let maybe_parsed = Url::parse(url.as_ref());
+ match maybe_parsed {
+ Ok(parsed) => match parsed.scheme() {
"s3" | "s3a" => {
self.bucket_name = parsed.host_str().map(|host|
host.to_owned());
}
"https" => {
if let Some(host) = parsed.host_str() {
- let parts = host.splitn(3, '.').collect::<Vec<&str>>();
- if parts.len() == 3
- && parts[0] == "s3"
- && parts[2] == "amazonaws.com"
+ let parts = host.splitn(4, '.').collect::<Vec<&str>>();
+ if parts.len() == 4 && parts[0] == "s3" && parts[2] ==
"amazonaws"
{
self.bucket_name = Some(parts[1].to_string());
}
+ if parts.len() == 4
+ && parts[1] == "s3"
+ && parts[3] == "amazonaws.com"
+ {
+ self.bucket_name = Some(parts[0].to_string());
Review Comment:
I think this should also set `virtual_hosted_style_request` to true
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]