This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs-object-store.git


The following commit(s) were added to refs/heads/main by this push:
     new 4ae6ca0  Allow parsing S3 URLs without region (#523)
4ae6ca0 is described below

commit 4ae6ca0ff9e53e618991eca7717de09c1364d8cc
Author: Kyle Barron <[email protected]>
AuthorDate: Fri Oct 31 16:32:56 2025 -0400

    Allow parsing S3 URLs without region (#523)
---
 src/aws/builder.rs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/aws/builder.rs b/src/aws/builder.rs
index 04d9d31..79d6b0f 100644
--- a/src/aws/builder.rs
+++ b/src/aws/builder.rs
@@ -736,6 +736,10 @@ impl AmazonS3Builder {
                         self.bucket_name = Some(bucket.into());
                     }
                 }
+                Some((bucket, "s3", "amazonaws", "com")) => {
+                    self.bucket_name = Some(bucket.to_string());
+                    self.virtual_hosted_style_request = true.into();
+                }
                 Some((bucket, "s3", region, "amazonaws.com")) => {
                     self.bucket_name = Some(bucket.to_string());
                     self.region = Some(region.to_string());
@@ -1553,6 +1557,13 @@ mod tests {
         assert_eq!(builder.region, Some("region".to_string()));
         assert_eq!(builder.bucket_name, Some("bucket.with.dot".to_string()));
 
+        let mut builder = AmazonS3Builder::new();
+        builder
+            .parse_url("https://bucket.s3.amazonaws.com";)
+            .unwrap();
+        assert_eq!(builder.bucket_name, Some("bucket".to_string()));
+        assert!(builder.virtual_hosted_style_request.get().unwrap());
+
         let mut builder = AmazonS3Builder::new();
         builder
             .parse_url("https://bucket.s3.region.amazonaws.com";)

Reply via email to