mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-12-23 22:11:10 +02:00
19 lines
396 B
Go
19 lines
396 B
Go
package common
|
|
|
|
import (
|
|
"slices"
|
|
)
|
|
|
|
// IsBucketAllowed checks if the provided bucket is allowed based on allowed and denied buckets lists.
|
|
func IsBucketAllowed(bucket string, allowedBuckets, deniedBuckets []string) bool {
|
|
if len(allowedBuckets) > 0 && !slices.Contains(allowedBuckets, bucket) {
|
|
return false
|
|
}
|
|
|
|
if slices.Contains(deniedBuckets, bucket) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|