|
|
@ -2231,8 +2231,15 @@ func (api objectAPIHandlers) PutObjectExtractHandler(w http.ResponseWriter, r *h |
|
|
|
putObject = objectAPI.PutObject |
|
|
|
) |
|
|
|
|
|
|
|
// Check if put is allowed
|
|
|
|
if s3Err = isPutActionAllowed(ctx, rAuthType, bucket, object, r, policy.PutObjectAction); s3Err != ErrNone { |
|
|
|
var opts untarOptions |
|
|
|
opts.ignoreDirs = strings.EqualFold(r.Header.Get(xhttp.MinIOSnowballIgnoreDirs), "true") |
|
|
|
opts.ignoreErrs = strings.EqualFold(r.Header.Get(xhttp.MinIOSnowballIgnoreErrors), "true") |
|
|
|
opts.prefixAll = r.Header.Get(xhttp.MinIOSnowballPrefix) |
|
|
|
if opts.prefixAll != "" { |
|
|
|
opts.prefixAll = trimLeadingSlash(pathJoin(opts.prefixAll, slashSeparator)) |
|
|
|
} |
|
|
|
// Check if put is allow for specified prefix.
|
|
|
|
if s3Err = isPutActionAllowed(ctx, rAuthType, bucket, opts.prefixAll, r, policy.PutObjectAction); s3Err != ErrNone { |
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Err), r.URL) |
|
|
|
return |
|
|
|
} |
|
|
@ -2300,7 +2307,10 @@ func (api objectAPIHandlers) PutObjectExtractHandler(w http.ResponseWriter, r *h |
|
|
|
|
|
|
|
putObjectTar := func(reader io.Reader, info os.FileInfo, object string) error { |
|
|
|
size := info.Size() |
|
|
|
|
|
|
|
if s3Err = isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, policy.PutObjectAction); s3Err != ErrNone { |
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Err), r.URL) |
|
|
|
return errors.New(errorCodes.ToAPIErr(s3Err).Code) |
|
|
|
} |
|
|
|
metadata := map[string]string{ |
|
|
|
xhttp.AmzStorageClass: sc, // save same storage-class as incoming stream.
|
|
|
|
} |
|
|
@ -2336,7 +2346,7 @@ func (api objectAPIHandlers) PutObjectExtractHandler(w http.ResponseWriter, r *h |
|
|
|
|
|
|
|
if r.Header.Get(xhttp.AmzBucketReplicationStatus) == replication.Replica.String() { |
|
|
|
if s3Err = isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, policy.ReplicateObjectAction); s3Err != ErrNone { |
|
|
|
return err |
|
|
|
return errors.New(errorCodes.ToAPIErr(s3Err).Code) |
|
|
|
} |
|
|
|
metadata[ReservedMetadataPrefixLower+ReplicaStatus] = replication.Replica.String() |
|
|
|
metadata[ReservedMetadataPrefixLower+ReplicaTimestamp] = UTCNow().Format(time.RFC3339Nano) |
|
|
@ -2483,14 +2493,6 @@ func (api objectAPIHandlers) PutObjectExtractHandler(w http.ResponseWriter, r *h |
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
|
|
var opts untarOptions |
|
|
|
opts.ignoreDirs = strings.EqualFold(r.Header.Get(xhttp.MinIOSnowballIgnoreDirs), "true") |
|
|
|
opts.ignoreErrs = strings.EqualFold(r.Header.Get(xhttp.MinIOSnowballIgnoreErrors), "true") |
|
|
|
opts.prefixAll = r.Header.Get(xhttp.MinIOSnowballPrefix) |
|
|
|
if opts.prefixAll != "" { |
|
|
|
opts.prefixAll = trimLeadingSlash(pathJoin(opts.prefixAll, slashSeparator)) |
|
|
|
} |
|
|
|
|
|
|
|
if err = untar(ctx, hreader, putObjectTar, opts); err != nil { |
|
|
|
apiErr := errorCodes.ToAPIErr(s3Err) |
|
|
|
// If not set, convert or use BadRequest
|
|
|
|