From 0f6acdb1fd764220b60f6e7ee29ff1a7462a44de Mon Sep 17 00:00:00 2001 From: xiandan Date: Thu, 9 Jan 2025 17:52:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(storage):=20=E4=B8=BA=20Minio=20=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9C=AC=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E8=B7=B3=E8=BF=87=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/setting/storage.go | 1 + modules/storage/minio.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/setting/storage.go b/modules/setting/storage.go index d3d1fb9f30..2ddafd7c5b 100644 --- a/modules/setting/storage.go +++ b/modules/setting/storage.go @@ -52,6 +52,7 @@ type MinioStorageConfig struct { ChecksumAlgorithm string `ini:"MINIO_CHECKSUM_ALGORITHM" json:",omitempty"` ServeDirect bool `ini:"SERVE_DIRECT"` BucketLookUpType string `ini:"MINIO_BUCKET_LOOKUP_TYPE" json:",omitempty"` + SkipVersionCheck bool `ini:"SKIP_VERSION_CHECK" json:",omitempty"` } func (cfg *MinioStorageConfig) ToShadow() { diff --git a/modules/storage/minio.go b/modules/storage/minio.go index 6b92be61fb..b026654931 100644 --- a/modules/storage/minio.go +++ b/modules/storage/minio.go @@ -112,7 +112,9 @@ func NewMinioStorage(ctx context.Context, cfg *setting.Storage) (ObjectStorage, // Otherwise even if the request itself fails (403, 404, etc), the code should still continue because the parameters seem "good" enough. // Keep in mind that GetBucketVersioning requires "owner" to really succeed, so it can't be used to check the existence. // Not using "BucketExists (HeadBucket)" because it doesn't include detailed failure reasons. - err = getBucketVersioning(ctx, minioClient, config.Bucket) + if !config.SkipVersionCheck { + err = getBucketVersioning(ctx, minioClient, config.Bucket) + } if err != nil { errResp, ok := err.(minio.ErrorResponse) if !ok {