You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2026/04/20 01:34:54 UTC

(opendal) branch main updated: fix(s3): fix dead code to strip suffix (#7411)

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

Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new f385a8e5c fix(s3): fix dead code to strip suffix (#7411)
f385a8e5c is described below

commit f385a8e5c598dc36fe869a55175fb1400148f3a8
Author: dentiny <de...@gmail.com>
AuthorDate: Sun Apr 19 18:34:48 2026 -0700

    fix(s3): fix dead code to strip suffix (#7411)
    
    * fix(s3): fix dead code to strip suffix
    
    * fix region test
---
 core/services/s3/src/backend.rs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/core/services/s3/src/backend.rs b/core/services/s3/src/backend.rs
index 3fd62ee69..3413fd5e8 100644
--- a/core/services/s3/src/backend.rs
+++ b/core/services/s3/src/backend.rs
@@ -636,11 +636,10 @@ impl S3Builder {
         // - `oss-ap-southeast-1.aliyuncs.com` => `oss-ap-southeast-1`
         // - `oss-cn-hangzhou-internal.aliyuncs.com` => `oss-cn-hangzhou`
         if let Some(v) = endpoint.strip_prefix("https://") {
-            if let Some(region) = v.strip_suffix(".aliyuncs.com") {
+            if let Some(region) = v.strip_suffix("-internal.aliyuncs.com") {
                 return Some(region.to_string());
             }
-
-            if let Some(region) = v.strip_suffix("-internal.aliyuncs.com") {
+            if let Some(region) = v.strip_suffix(".aliyuncs.com") {
                 return Some(region.to_string());
             }
         }
@@ -1228,7 +1227,7 @@ mod tests {
                 "oss with internal endpoint",
                 "https://oss-cn-hangzhou-internal.aliyuncs.com",
                 "example",
-                Some("oss-cn-hangzhou-internal"),
+                Some("oss-cn-hangzhou"),
             ),
             (
                 "r2",