You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@paimon.apache.org by lz...@apache.org on 2025/04/05 03:20:46 UTC

(paimon) branch master updated: [core] RESTCatalog: update parse region from dlf endpoint (#5404)

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

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new decd9b5942 [core] RESTCatalog: update parse region from dlf endpoint (#5404)
decd9b5942 is described below

commit decd9b594295d204393251200eebb58e037f163c
Author: shyjsarah <44...@users.noreply.github.com>
AuthorDate: Sat Apr 5 11:20:40 2025 +0800

    [core] RESTCatalog: update parse region from dlf endpoint (#5404)
---
 .../org/apache/paimon/rest/auth/DLFAuthProviderFactory.java  |  2 +-
 .../apache/paimon/rest/auth/DLFAuthProviderFactoryTest.java  | 12 +++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/paimon-core/src/main/java/org/apache/paimon/rest/auth/DLFAuthProviderFactory.java b/paimon-core/src/main/java/org/apache/paimon/rest/auth/DLFAuthProviderFactory.java
index 1c8474fb13..72d9ea5580 100644
--- a/paimon-core/src/main/java/org/apache/paimon/rest/auth/DLFAuthProviderFactory.java
+++ b/paimon-core/src/main/java/org/apache/paimon/rest/auth/DLFAuthProviderFactory.java
@@ -64,7 +64,7 @@ public class DLFAuthProviderFactory implements AuthProviderFactory {
 
     protected static String parseRegionFromUri(String uri) {
         try {
-            String regex = "dlf-(?:pre-)?([a-z]+-[a-z]+(?:-\\d+)?)";
+            String regex = "(?:pre-)?([a-z]+-[a-z]+(?:-\\d+)?)";
 
             Pattern pattern = Pattern.compile(regex);
             Matcher matcher = pattern.matcher(uri);
diff --git a/paimon-core/src/test/java/org/apache/paimon/rest/auth/DLFAuthProviderFactoryTest.java b/paimon-core/src/test/java/org/apache/paimon/rest/auth/DLFAuthProviderFactoryTest.java
index 5dfc5768cc..efda5ea37c 100644
--- a/paimon-core/src/test/java/org/apache/paimon/rest/auth/DLFAuthProviderFactoryTest.java
+++ b/paimon-core/src/test/java/org/apache/paimon/rest/auth/DLFAuthProviderFactoryTest.java
@@ -29,16 +29,18 @@ class DLFAuthProviderFactoryTest {
     @Test
     void getRegion() {
         String region = "cn-hangzhou";
-        String url = "https://dlf-" + region + "-internal.aliyuncs.com";
+        String url = "https://" + region + "-vpc.dlf.aliyuncs.com";
         assertEquals(region, DLFAuthProviderFactory.parseRegionFromUri(url));
-        url = "https://dlf-" + region + ".aliyuncs.com";
+        url = "https://" + region + "-intranet.dlf.aliyuncs.com";
         assertEquals(region, DLFAuthProviderFactory.parseRegionFromUri(url));
-        url = "https://dlf-pre-" + region + ".aliyuncs.com";
+        url = "https://" + region + ".dlf.aliyuncs.com";
+        assertEquals(region, DLFAuthProviderFactory.parseRegionFromUri(url));
+        url = "https://pre-" + region + "-vpc.dlf.aliyuncs.com";
         assertEquals(region, DLFAuthProviderFactory.parseRegionFromUri(url));
         region = "us-east-1";
-        url = "https://dlf-" + region + ".aliyuncs.com";
+        url = "https://" + region + "-vpc.dlf.aliyuncs.com";
         assertEquals(region, DLFAuthProviderFactory.parseRegionFromUri(url));
-        url = "https://dlf-" + region + "-internal.aliyuncs.com";
+        url = "https://" + region + "-intranet.dlf.aliyuncs.com";
         assertEquals(region, DLFAuthProviderFactory.parseRegionFromUri(url));
         String ipPortUri = "http://127.0.0.1:8080";
         assertThrows(