Skip to content

Commit

Permalink
fix: Fixes 330, Fixes 334, Fixed copySrcModifSince bug in CopyObject…
Browse files Browse the repository at this point in the history
… action

commit 48d951e
Author: jonaustin09 <[email protected]>
Date:   Wed Dec 13 09:06:44 2023 -0500
  • Loading branch information
benmcclelland committed Dec 13, 2023
1 parent e9f01c8 commit c6cbd82
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions s3api/controllers/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,20 +595,21 @@ func (c S3ApiController) PutActions(ctx *fiber.Ctx) error {
return SendXMLResponse(ctx, nil, err, &MetaOpts{Logger: c.logger, Action: "CopyObject", BucketOwner: parsedAcl.Owner})
}

var mtime time.Time
var err error
var mtime *time.Time
var umtime *time.Time
if copySrcModifSince != "" {
mtime, err = time.Parse(iso8601Format, copySrcModifSince)
tm, err := time.Parse(iso8601Format, copySrcModifSince)
if err != nil {
return SendXMLResponse(ctx, nil, s3err.GetAPIError(s3err.ErrInvalidCopySource), &MetaOpts{Logger: c.logger, Action: "CopyObject", BucketOwner: parsedAcl.Owner})
}
mtime = &tm
}
var umtime time.Time
if copySrcModifSince != "" {
mtime, err = time.Parse(iso8601Format, copySrcUnmodifSince)
if copySrcUnmodifSince != "" {
tm, err := time.Parse(iso8601Format, copySrcUnmodifSince)
if err != nil {
return SendXMLResponse(ctx, nil, s3err.GetAPIError(s3err.ErrInvalidCopySource), &MetaOpts{Logger: c.logger, Action: "CopyObject", BucketOwner: parsedAcl.Owner})
}
umtime = &tm
}

metadata := utils.GetUserMetaData(&ctx.Request().Header)
Expand All @@ -619,8 +620,8 @@ func (c S3ApiController) PutActions(ctx *fiber.Ctx) error {
CopySource: &copySource,
CopySourceIfMatch: &copySrcIfMatch,
CopySourceIfNoneMatch: &copySrcIfNoneMatch,
CopySourceIfModifiedSince: &mtime,
CopySourceIfUnmodifiedSince: &umtime,
CopySourceIfModifiedSince: mtime,
CopySourceIfUnmodifiedSince: umtime,
ExpectedBucketOwner: &acct.Access,
Metadata: metadata,
})
Expand Down

0 comments on commit c6cbd82

Please sign in to comment.