forked from TrueCloudLab/frostfs-s3-gw
[#619] Filter system metadata
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
parent
4380406602
commit
4483c6f57a
2 changed files with 22 additions and 10 deletions
|
@ -2,15 +2,16 @@ package api
|
|||
|
||||
// Standard S3 HTTP request/response constants.
|
||||
const (
|
||||
MetadataPrefix = "X-Amz-Meta-"
|
||||
AmzMetadataDirective = "X-Amz-Metadata-Directive"
|
||||
AmzVersionID = "X-Amz-Version-Id"
|
||||
AmzTaggingCount = "X-Amz-Tagging-Count"
|
||||
AmzTagging = "X-Amz-Tagging"
|
||||
AmzDeleteMarker = "X-Amz-Delete-Marker"
|
||||
AmzCopySource = "X-Amz-Copy-Source"
|
||||
AmzCopySourceRange = "X-Amz-Copy-Source-Range"
|
||||
AmzDate = "X-Amz-Date"
|
||||
MetadataPrefix = "X-Amz-Meta-"
|
||||
NeoFSSystemMetadataPrefix = "S3-"
|
||||
AmzMetadataDirective = "X-Amz-Metadata-Directive"
|
||||
AmzVersionID = "X-Amz-Version-Id"
|
||||
AmzTaggingCount = "X-Amz-Tagging-Count"
|
||||
AmzTagging = "X-Amz-Tagging"
|
||||
AmzDeleteMarker = "X-Amz-Delete-Marker"
|
||||
AmzCopySource = "X-Amz-Copy-Source"
|
||||
AmzCopySourceRange = "X-Amz-Copy-Source-Range"
|
||||
AmzDate = "X-Amz-Date"
|
||||
|
||||
LastModified = "Last-Modified"
|
||||
Date = "Date"
|
||||
|
@ -88,3 +89,13 @@ var ResponseModifiers = map[string]string{
|
|||
"response-content-disposition": ContentDisposition,
|
||||
"response-content-encoding": ContentEncoding,
|
||||
}
|
||||
|
||||
var SystemMetadata = map[string]struct{}{
|
||||
Date: {},
|
||||
CacheControl: {},
|
||||
ContentDisposition: {},
|
||||
ContentLength: {},
|
||||
ContentType: {},
|
||||
LastModified: {},
|
||||
ETag: {},
|
||||
}
|
||||
|
|
|
@ -613,7 +613,8 @@ func (n *layer) getAllObjectsVersions(ctx context.Context, bkt *data.BucketInfo,
|
|||
}
|
||||
|
||||
func IsSystemHeader(key string) bool {
|
||||
return strings.HasPrefix(key, "S3-")
|
||||
_, ok := api.SystemMetadata[key]
|
||||
return ok || strings.HasPrefix(key, api.NeoFSSystemMetadataPrefix)
|
||||
}
|
||||
|
||||
func shouldSkip(node *data.NodeVersion, p allObjectParams, existed map[string]struct{}) bool {
|
||||
|
|
Loading…
Reference in a new issue