[BREAKING] Changer Config.Server.Buckets à un map[string]string #98
1 changed files with 7 additions and 7 deletions
|
@ -72,16 +72,16 @@ func HandleV1BucketList(c echo.Context) error {
|
|||
})
|
||||
}
|
||||
|
||||
var buckets []string
|
||||
var buckets = make(map[string]string)
|
||||
|
||||
for _, bucket_name := range cfg.Server.Documents.Buckets {
|
||||
for bucket_name, bucket_display_name := range cfg.Server.Documents.Buckets {
|
||||
exists, err := mediaClient.MinioClient.BucketExists(context.Background(), bucket_name)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusInternalServerError, "Error during minio#BucketExists")
|
||||
}
|
||||
|
||||
if exists {
|
||||
buckets = append(buckets, bucket_name)
|
||||
buckets[bucket_name] = bucket_display_name
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ func HandleV1BucketRead(c echo.Context) error {
|
|||
bucket := c.Param("bucket")
|
||||
|
||||
allowed := false
|
||||
for _, bucket_allowed := range cfg.Server.Documents.Buckets {
|
||||
for bucket_allowed := range cfg.Server.Documents.Buckets {
|
||||
if bucket == bucket_allowed {
|
||||
allowed = true
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ func HandleV1DocumentCreate(c echo.Context) error {
|
|||
}
|
||||
|
||||
allowed := false
|
||||
for _, bucket_allowed := range cfg.Server.Documents.Buckets {
|
||||
for bucket_allowed := range cfg.Server.Documents.Buckets {
|
||||
if bucket == bucket_allowed {
|
||||
allowed = true
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ func HandleV1DocumentRead(c echo.Context) error {
|
|||
document := c.Param("document")
|
||||
|
||||
allowed := false
|
||||
for _, bucket_allowed := range cfg.Server.Documents.Buckets {
|
||||
for bucket_allowed := range cfg.Server.Documents.Buckets {
|
||||
if bucket == bucket_allowed {
|
||||
allowed = true
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ func HandleV1DocumentDelete(c echo.Context) error {
|
|||
document := c.Param("document")
|
||||
|
||||
allowed := false
|
||||
for _, bucket_allowed := range cfg.Server.Documents.Buckets {
|
||||
for bucket_allowed := range cfg.Server.Documents.Buckets {
|
||||
if bucket == bucket_allowed {
|
||||
allowed = true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue