From 082031cc85d47cc6198c898532d233d3b022b6fd Mon Sep 17 00:00:00 2001 From: Mozi <29089388+pzhlkj6612@users.noreply.github.com> Date: Sun, 5 Apr 2026 18:04:32 +0000 Subject: [PATCH] s3: fix TencentCOS CDN endpoint failing on bucket check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Global Acceleration Endpoint (cos.accelerate.myqcloud.com) of Tencent COS does not seem to support "CreateBucket" (maybe also other bucket management operations). Since the acceleration functionality must be enabled per-bucket in the Tencent Cloud console, the bucket will always exist before this endpoint is used, so this check can be safely skipped. Now, "no_check_bucket = true" will be auto set when using this endpoint. Why "NewFs()": on-the-fly remotes (connection string remotes), for example, ":s3,provider=TencentCOS,...:..." will also be fixed. Why no unit test: I can't find a good way to test "NewFs()" without leveraging live endpoints. I think we can extract all existing mutations for different providers (e.g., AWS, Fastly, and Rabata) from "NewFs()" to a new function in the future. Some Tencent docs about this CDN endpoint: - English: Global Acceleration Endpoint | https://www.tencentcloud.com/pt/document/product/436/40700 - Chinese: 对象存储 全球加速概述_腾讯云 | https://cloud.tencent.com/document/product/436/38866 Assisted-By: OpenCode --- backend/s3/s3.go | 4 ++++ docs/content/s3.md | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 6c799ec18..5bfc118a9 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -1861,6 +1861,10 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e if opt.Provider == "Rabata" { f.features.Copy = nil } + if opt.Provider == "TencentCOS" && strings.Contains(opt.Endpoint, "cos.accelerate.myqcloud.com") { + // Global Acceleration endpoint does not support bucket creation. + f.opt.NoCheckBucket = true + } if opt.DirectoryMarkers { f.features.CanHaveEmptyDirectories = true } diff --git a/docs/content/s3.md b/docs/content/s3.md index 2ca9a8d8c..369f8866f 100644 --- a/docs/content/s3.md +++ b/docs/content/s3.md @@ -9119,6 +9119,16 @@ To configure access to Tencent COS, follow the steps below: ==== ==== cos s3 ``` + +#### Tencent COS Global Acceleration Endpoint + +When using the Global Acceleration Endpoint (`cos.accelerate.myqcloud.com`), +rclone automatically sets `no_check_bucket = true` because this acceleration +endpoint does not support the `CreateBucket` call which is used for ensuring +a bucket's existence by rclone. Global Acceleration is a per-bucket feature, +so you should first create the bucket in one physical region, then enable it +in the Tencent Cloud console. + ### US3 {#us3} [US3](https://www.ucloud.cn/site/product/ufile.html) Object Storage is a service that provides cloud storage for unstructured files for internet applications.