From bc8d67ce784c7d1a793df9c0aa29c19ad0860877 Mon Sep 17 00:00:00 2001 From: Yang_Ming <49151911+code-better-life@users.noreply.github.com> Date: Tue, 7 Apr 2026 16:38:23 +0800 Subject: [PATCH] feat: add region parameter support to MinIO connection (#13954) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Add optional `region` parameter to `Minio()` client constructor in `rag/utils/minio_conn.py` - Reads from `MINIO.region` in settings, defaults to `None` when not configured - Required by some S3-compatible storage services (e.g., AWS S3, Tencent COS) for proper bucket access ## Motivation When using RAGFlow with S3-compatible storage that requires a region (such as AWS S3 or Tencent Cloud COS), the MinIO client fails to access buckets because the `region` parameter is not passed through. The `Minio()` Python client already supports the `region` parameter natively — this PR simply wires it up from the RAGFlow configuration. ## Changes - `rag/utils/minio_conn.py`: Pass `region=settings.MINIO.get("region", None) or None` to `Minio()` constructor ## Backward Compatibility - No breaking changes. When `region` is not configured, it defaults to `None`, preserving the existing behavior exactly. ## Test Plan - [ ] Verified with MinIO (no region set) — works as before - [x] Verified with S3-compatible storage requiring region — bucket access succeeds ## Summary by CodeRabbit * **Bug Fixes** * Enhanced MinIO client initialization with regional configuration support for improved compatibility with region-specific deployments. Co-authored-by: Jarry Wang Co-authored-by: Jin Hai --- rag/utils/minio_conn.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rag/utils/minio_conn.py b/rag/utils/minio_conn.py index 3800b77774..5e46306cd1 100644 --- a/rag/utils/minio_conn.py +++ b/rag/utils/minio_conn.py @@ -106,6 +106,7 @@ class RAGFlowMinio: access_key=settings.MINIO["user"], secret_key=settings.MINIO["password"], secure=secure, + region=settings.MINIO.get("region", None) or None, http_client=http_client, ) except Exception: