mirror of
https://github.com/minio/minio.git
synced 2025-11-23 02:57:42 -05:00
Filter out internal object prefix during listing (#4435)
We use ZZZZ-Minio/ prefix internally in our GCS gateway which should be filtered out in the response to ListObjects.
This commit is contained in:
committed by
Harshavardhana
parent
9bd0eb1a9e
commit
8085ba4494
@@ -44,6 +44,11 @@ const (
|
||||
ZZZZMinioPrefix = "ZZZZ-Minio"
|
||||
)
|
||||
|
||||
// Check if object prefix is "ZZZZ_Minio".
|
||||
func isGCSPrefix(prefix string) bool {
|
||||
return strings.TrimSuffix(prefix, slashSeparator) == ZZZZMinioPrefix
|
||||
}
|
||||
|
||||
// Convert Minio errors to minio object layer errors.
|
||||
func gcsToObjectError(err error, params ...string) error {
|
||||
if err == nil {
|
||||
@@ -325,7 +330,7 @@ func (l *gcsGateway) ListObjects(bucket string, prefix string, marker string, de
|
||||
|
||||
attrs, _ := it.Next()
|
||||
if attrs == nil {
|
||||
} else if attrs.Prefix == ZZZZMinioPrefix {
|
||||
} else if isGCSPrefix(attrs.Prefix) {
|
||||
break
|
||||
}
|
||||
|
||||
@@ -342,7 +347,7 @@ func (l *gcsGateway) ListObjects(bucket string, prefix string, marker string, de
|
||||
|
||||
nextMarker = toGCSPageToken(attrs.Name)
|
||||
|
||||
if attrs.Prefix == ZZZZMinioPrefix {
|
||||
if isGCSPrefix(attrs.Prefix) {
|
||||
// we don't return our metadata prefix
|
||||
continue
|
||||
} else if attrs.Prefix != "" {
|
||||
|
||||
Reference in New Issue
Block a user