do not save any metadata from the headers in tar extract (#17436)

only preserve the same storage-class as incoming
request other than that rest of them must be
deduced.
This commit is contained in:
Harshavardhana 2023-06-15 17:44:07 -07:00 committed by GitHub
parent e98309eb75
commit 47a48b6832
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 26 deletions

View File

@ -2111,36 +2111,16 @@ func (api objectAPIHandlers) PutObjectExtractHandler(w http.ResponseWriter, r *h
getObjectInfo = api.CacheAPI().GetObjectInfo
}
// Extract request metadata
metadata, err := extractMetadata(ctx, r)
if err != nil {
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
return
}
// Remove the snowball headers from metadata from objects
// since those are actionable headers and not for storage
delete(metadata, xhttp.AmzSnowballExtract)
delete(metadata, xhttp.AmzSnowballExtract)
delete(metadata, xhttp.MinIOSnowballIgnoreDirs)
delete(metadata, xhttp.MinIOSnowballIgnoreErrors)
delete(metadata, xhttp.MinIOSnowballPrefix)
// Use the same storage class as the original uploaded tar file
if sc != "" {
metadata[xhttp.AmzStorageClass] = sc
}
putObjectTar := func(reader io.Reader, info os.FileInfo, object string) error {
size := info.Size()
// Copy metadata and make space for a bit more
metaCopy := make(map[string]string, len(metadata)+5)
for k, v := range metadata {
metaCopy[k] = v
if sc == "" {
sc = storageclass.STANDARD
}
metadata := map[string]string{
xhttp.AmzStorageClass: sc, // save same storage-class as incoming stream.
}
// Shadow now...
metadata := metaCopy
actualSize := size
var idxCb func() []byte