Skip to content

Commit

Permalink
keep stat() and list() lastModified upto same resolution (#1638)
Browse files Browse the repository at this point in the history
fixes #1632
  • Loading branch information
harshavardhana committed Apr 18, 2022
1 parent 8142170 commit fbcac8c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api-list.go
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"net/http"
"net/url"
"time"

"github.com/minio/minio-go/v7/pkg/s3utils"
)
Expand Down Expand Up @@ -239,6 +240,7 @@ func (c *Client) listObjectsV2Query(ctx context.Context, bucketName, objectPrefi
if err != nil {
return listBucketResult, err
}
listBucketResult.Contents[i].LastModified = listBucketResult.Contents[i].LastModified.Truncate(time.Millisecond)
}

for i, obj := range listBucketResult.CommonPrefixes {
Expand Down Expand Up @@ -384,7 +386,7 @@ func (c *Client) listObjectVersions(ctx context.Context, bucketName string, opts
info := ObjectInfo{
ETag: trimEtag(version.ETag),
Key: version.Key,
LastModified: version.LastModified,
LastModified: version.LastModified.Truncate(time.Millisecond),
Size: version.Size,
Owner: version.Owner,
StorageClass: version.StorageClass,
Expand Down Expand Up @@ -600,6 +602,7 @@ func (c *Client) listObjectsQuery(ctx context.Context, bucketName, objectPrefix,
if err != nil {
return listBucketResult, err
}
listBucketResult.Contents[i].LastModified = listBucketResult.Contents[i].LastModified.Truncate(time.Millisecond)
}

for i, obj := range listBucketResult.CommonPrefixes {
Expand Down

0 comments on commit fbcac8c

Please sign in to comment.