1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-05 01:34:25 +00:00
gitea/modules/storage
Earl Warren 7818121d50
S3: log human readable error on connection failure (#26856)
Should BucketExists (HeadBucket) fail because of an error related to
the connection rather than the existence of the bucket, no information
is available and the admin is left guessing.

https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadBucket.html

> This action is useful to determine if a bucket exists and you have
> permission to access it. The action returns a 200 OK if the bucket
> exists and you have permission to access it.
>
> If the bucket does not exist or you do not have permission to access
> it, the HEAD request returns a generic 400 Bad Request, 403
> Forbidden or 404 Not Found code. A message body is not included, so
> you cannot determine the exception beyond these error codes.

GetBucketVersioning is used instead and exclusively dedicated to
asserting if using the connection does not return a BadRequest.
If it does the NewMinioStorage logs an error and returns. Otherwise
it keeps going knowing that BucketExists is not going to fail for
reasons unrelated to the existence of the bucket and the permissions
to access it.

(cherry picked from commit d1df4b3bc62e5e61893a923f1c4b58f084eb03af)

Refs: https://codeberg.org/forgejo/forgejo/issues/1338
2023-09-12 10:19:39 +08:00
..
helper_test.go add path prefix to ObjectStorage.Iterator (#23332) 2023-03-13 18:23:51 +08:00
helper.go Fix all possible setting error related storages and added some tests (#23911) 2023-06-14 11:42:38 +08:00
local_test.go Fix all possible setting error related storages and added some tests (#23911) 2023-06-14 11:42:38 +08:00
local.go Fix all possible setting error related storages and added some tests (#23911) 2023-06-14 11:42:38 +08:00
minio_test.go S3: log human readable error on connection failure (#26856) 2023-09-12 10:19:39 +08:00
minio.go S3: log human readable error on connection failure (#26856) 2023-09-12 10:19:39 +08:00
storage_test.go Fix all possible setting error related storages and added some tests (#23911) 2023-06-14 11:42:38 +08:00
storage.go Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00