diff --git a/cmd/bucket-replication.go b/cmd/bucket-replication.go index 9177246f1..b19863e83 100644 --- a/cmd/bucket-replication.go +++ b/cmd/bucket-replication.go @@ -983,7 +983,7 @@ func replicateObject(ctx context.Context, ri ReplicateObjectInfo, objectAPI Obje popts := ObjectOptions{ MTime: objInfo.ModTime, VersionID: objInfo.VersionID, - EvalMetadataFn: func(oi ObjectInfo) error { + EvalMetadataFn: func(oi *ObjectInfo) error { oi.UserDefined[ReservedMetadataPrefixLower+ReplicationStatus] = newReplStatusInternal oi.UserDefined[ReservedMetadataPrefixLower+ReplicationTimestamp] = UTCNow().Format(time.RFC3339Nano) oi.UserDefined[xhttp.AmzBucketReplicationStatus] = string(rinfos.ReplicationStatus()) diff --git a/cmd/erasure-object.go b/cmd/erasure-object.go index 19f9560ad..23476ad66 100644 --- a/cmd/erasure-object.go +++ b/cmd/erasure-object.go @@ -1744,7 +1744,7 @@ func (er erasureObjects) PutObjectMetadata(ctx context.Context, bucket, object s objInfo := fi.ToObjectInfo(bucket, object, opts.Versioned || opts.VersionSuspended) if opts.EvalMetadataFn != nil { - if err := opts.EvalMetadataFn(objInfo); err != nil { + if err := opts.EvalMetadataFn(&objInfo); err != nil { return ObjectInfo{}, err } } diff --git a/cmd/object-api-interface.go b/cmd/object-api-interface.go index f9015779b..9b66ca81c 100644 --- a/cmd/object-api-interface.go +++ b/cmd/object-api-interface.go @@ -36,7 +36,7 @@ import ( type CheckPreconditionFn func(o ObjectInfo) bool // EvalMetadataFn validates input objInfo and returns an updated metadata -type EvalMetadataFn func(o ObjectInfo) error +type EvalMetadataFn func(o *ObjectInfo) error // GetObjectInfoFn is the signature of GetObjectInfo function. type GetObjectInfoFn func(ctx context.Context, bucket, object string, opts ObjectOptions) (ObjectInfo, error) diff --git a/cmd/object-handlers.go b/cmd/object-handlers.go index c3b3d236a..808ddae56 100644 --- a/cmd/object-handlers.go +++ b/cmd/object-handlers.go @@ -2867,11 +2867,11 @@ func (api objectAPIHandlers) PutObjectLegalHoldHandler(w http.ResponseWriter, r popts := ObjectOptions{ MTime: opts.MTime, VersionID: opts.VersionID, - EvalMetadataFn: func(oi ObjectInfo) error { + EvalMetadataFn: func(oi *ObjectInfo) error { oi.UserDefined[strings.ToLower(xhttp.AmzObjectLockLegalHold)] = strings.ToUpper(string(legalHold.Status)) oi.UserDefined[ReservedMetadataPrefixLower+ObjectLockLegalHoldTimestamp] = UTCNow().Format(time.RFC3339Nano) - dsc := mustReplicate(ctx, bucket, object, getMustReplicateOptions(oi, replication.MetadataReplicationType, opts)) + dsc := mustReplicate(ctx, bucket, object, getMustReplicateOptions(*oi, replication.MetadataReplicationType, opts)) if dsc.ReplicateAny() { oi.UserDefined[ReservedMetadataPrefixLower+ReplicationTimestamp] = UTCNow().Format(time.RFC3339Nano) oi.UserDefined[ReservedMetadataPrefixLower+ReplicationStatus] = dsc.PendingStatus() @@ -3028,8 +3028,8 @@ func (api objectAPIHandlers) PutObjectRetentionHandler(w http.ResponseWriter, r popts := ObjectOptions{ MTime: opts.MTime, VersionID: opts.VersionID, - EvalMetadataFn: func(oi ObjectInfo) error { - if err := enforceRetentionBypassForPut(ctx, r, oi, objRetention, cred, owner); err != nil { + EvalMetadataFn: func(oi *ObjectInfo) error { + if err := enforceRetentionBypassForPut(ctx, r, *oi, objRetention, cred, owner); err != nil { return err } if objRetention.Mode.Valid() { @@ -3040,7 +3040,7 @@ func (api objectAPIHandlers) PutObjectRetentionHandler(w http.ResponseWriter, r oi.UserDefined[strings.ToLower(xhttp.AmzObjectLockRetainUntilDate)] = "" } oi.UserDefined[ReservedMetadataPrefixLower+ObjectLockRetentionTimestamp] = UTCNow().Format(time.RFC3339Nano) - dsc := mustReplicate(ctx, bucket, object, getMustReplicateOptions(oi, replication.MetadataReplicationType, opts)) + dsc := mustReplicate(ctx, bucket, object, getMustReplicateOptions(*oi, replication.MetadataReplicationType, opts)) if dsc.ReplicateAny() { oi.UserDefined[ReservedMetadataPrefixLower+ReplicationTimestamp] = UTCNow().Format(time.RFC3339Nano) oi.UserDefined[ReservedMetadataPrefixLower+ReplicationStatus] = dsc.PendingStatus() diff --git a/cmd/s3-zip-handlers.go b/cmd/s3-zip-handlers.go index e7375ba95..fc6dbd880 100644 --- a/cmd/s3-zip-handlers.go +++ b/cmd/s3-zip-handlers.go @@ -503,7 +503,7 @@ func updateObjectMetadataWithZipInfo(ctx context.Context, objectAPI ObjectLayer, popts := ObjectOptions{ MTime: srcInfo.ModTime, VersionID: srcInfo.VersionID, - EvalMetadataFn: func(oi ObjectInfo) error { + EvalMetadataFn: func(oi *ObjectInfo) error { oi.UserDefined[archiveTypeMetadataKey] = archiveType oi.UserDefined[archiveInfoMetadataKey] = zipInfoStr return nil