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 2023/07/20 07:57:01 UTC
[incubator-opendal] branch main updated: feat(s3): Use us-east-1 while head bucket returns 403 without X-Amz-Bucket-Region (#2677)
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/incubator-opendal.git
The following commit(s) were added to refs/heads/main by this push:
new ce892107b feat(s3): Use us-east-1 while head bucket returns 403 without X-Amz-Bucket-Region (#2677)
ce892107b is described below
commit ce892107b498adb44669f607fb47111f34b930ca
Author: john <we...@gmail.com>
AuthorDate: Thu Jul 20 15:56:56 2023 +0800
feat(s3): Use us-east-1 while head bucket returns 403 without X-Amz-Bucket-Region (#2677)
* s3 head with no X-Amz-Bucket-Region , using us-east-1 region as default
* fix cargo fmt
---
core/src/services/s3/backend.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/core/src/services/s3/backend.rs b/core/src/services/s3/backend.rs
index 69ca4adc2..50fa32f6a 100644
--- a/core/src/services/s3/backend.rs
+++ b/core/src/services/s3/backend.rs
@@ -619,7 +619,7 @@ impl S3Builder {
);
match res.status() {
- StatusCode::OK | StatusCode::FORBIDDEN | StatusCode::MOVED_PERMANENTLY => {
+ StatusCode::OK | StatusCode::MOVED_PERMANENTLY => {
let region = res.headers().get("x-amz-bucket-region")?;
if let Ok(regin) = region.to_str() {
Some(regin.to_string())
@@ -627,6 +627,7 @@ impl S3Builder {
None
}
}
+ StatusCode::FORBIDDEN => Some("us-east-1".to_string()),
// Unexpected status code
_ => None,
}