mirror of
https://github.com/go-gitea/gitea.git
synced 2025-01-26 14:52:26 +00:00
feat(storage): 为 Minio 存储添加版本检查跳过选项
This commit is contained in:
parent
88366f280e
commit
0f6acdb1fd
@ -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() {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user