This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new e9371325bd8 branch-2.1: [fix](s3) do not replace https scheme if specified #44242 (#44250) e9371325bd8 is described below commit e9371325bd8721ab46c4082be67846e9cc779f1f Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Tue Nov 19 17:12:42 2024 +0800 branch-2.1: [fix](s3) do not replace https scheme if specified #44242 (#44250) Cherry-picked from #44242 Co-authored-by: Mingyu Chen (Rayner) <morning...@163.com> --- .../main/java/org/apache/doris/catalog/S3Resource.java | 2 +- .../java/org/apache/doris/catalog/S3ResourceTest.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/S3Resource.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/S3Resource.java index e1cde40c4ad..a40e91f47d4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/S3Resource.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/S3Resource.java @@ -95,7 +95,7 @@ public class S3Resource extends Resource { // the endpoint for ping need add uri scheme. String pingEndpoint = properties.get(S3Properties.ENDPOINT); - if (!pingEndpoint.startsWith("http://")) { + if (!pingEndpoint.startsWith("http://") && !pingEndpoint.startsWith("https://")) { pingEndpoint = "http://" + properties.get(S3Properties.ENDPOINT); properties.put(S3Properties.ENDPOINT, pingEndpoint); properties.put(S3Properties.Env.ENDPOINT, pingEndpoint); diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/S3ResourceTest.java b/fe/fe-core/src/test/java/org/apache/doris/catalog/S3ResourceTest.java index 720e2690c05..4e620d56903 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/catalog/S3ResourceTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/S3ResourceTest.java @@ -222,4 +222,20 @@ public class S3ResourceTest { modify.put("s3.access_key", "aaa"); s3Resource.modifyProperties(modify); } + + @Test + public void testHttpScheme() throws DdlException { + // if https:// is set, it should be replaced with http:// + Map<String, String> properties = new HashMap<>(); + properties.put("AWS_ENDPOINT", "https://aaa"); + properties.put("AWS_REGION", "bbb"); + properties.put("AWS_ROOT_PATH", "/path/to/root"); + properties.put("AWS_ACCESS_KEY", "xxx"); + properties.put("AWS_SECRET_KEY", "yyy"); + properties.put("AWS_BUCKET", "test-bucket"); + properties.put("s3_validity_check", "false"); + S3Resource s3Resource = new S3Resource("s3_2"); + s3Resource.setProperties(properties); + Assert.assertEquals(s3Resource.getProperty(S3Properties.ENDPOINT), "https://aaa"); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org