Skip to content

Commit 0f6acdb

Browse files
committed
feat(storage): 为 Minio 存储添加版本检查跳过选项
1 parent 88366f2 commit 0f6acdb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

modules/setting/storage.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type MinioStorageConfig struct {
5252
ChecksumAlgorithm string `ini:"MINIO_CHECKSUM_ALGORITHM" json:",omitempty"`
5353
ServeDirect bool `ini:"SERVE_DIRECT"`
5454
BucketLookUpType string `ini:"MINIO_BUCKET_LOOKUP_TYPE" json:",omitempty"`
55+
SkipVersionCheck bool `ini:"SKIP_VERSION_CHECK" json:",omitempty"`
5556
}
5657

5758
func (cfg *MinioStorageConfig) ToShadow() {

modules/storage/minio.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ func NewMinioStorage(ctx context.Context, cfg *setting.Storage) (ObjectStorage,
112112
// Otherwise even if the request itself fails (403, 404, etc), the code should still continue because the parameters seem "good" enough.
113113
// Keep in mind that GetBucketVersioning requires "owner" to really succeed, so it can't be used to check the existence.
114114
// Not using "BucketExists (HeadBucket)" because it doesn't include detailed failure reasons.
115-
err = getBucketVersioning(ctx, minioClient, config.Bucket)
115+
if !config.SkipVersionCheck {
116+
err = getBucketVersioning(ctx, minioClient, config.Bucket)
117+
}
116118
if err != nil {
117119
errResp, ok := err.(minio.ErrorResponse)
118120
if !ok {

0 commit comments

Comments
 (0)