mirror of
https://github.com/minio/minio.git
synced 2025-01-25 21:53:16 -05:00
api: Nanosecond precision for API responses is valid with S3. (#2957)
Wqe need to be compatible as well fixes #2955
This commit is contained in:
parent
7fc1685b7a
commit
686a610fc3
@ -24,10 +24,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
timeFormatAMZ = "2006-01-02T15:04:05Z" // Reply date format
|
timeFormatAMZ = "2006-01-02T15:04:05Z" // Reply date format
|
||||||
maxObjectList = 1000 // Limit number of objects in a listObjectsResponse.
|
timeFormatAMZLong = "2006-01-02T15:04:05.000Z" // Reply date format with nanosecond precision.
|
||||||
maxUploadsList = 1000 // Limit number of uploads in a listUploadsResponse.
|
maxObjectList = 1000 // Limit number of objects in a listObjectsResponse.
|
||||||
maxPartsList = 1000 // Limit number of parts in a listPartsResponse.
|
maxUploadsList = 1000 // Limit number of uploads in a listUploadsResponse.
|
||||||
|
maxPartsList = 1000 // Limit number of parts in a listPartsResponse.
|
||||||
)
|
)
|
||||||
|
|
||||||
// LocationResponse - format for location response.
|
// LocationResponse - format for location response.
|
||||||
@ -277,7 +278,7 @@ func generateListBucketsResponse(buckets []BucketInfo) ListBucketsResponse {
|
|||||||
for _, bucket := range buckets {
|
for _, bucket := range buckets {
|
||||||
var listbucket = Bucket{}
|
var listbucket = Bucket{}
|
||||||
listbucket.Name = bucket.Name
|
listbucket.Name = bucket.Name
|
||||||
listbucket.CreationDate = bucket.Created.Format(timeFormatAMZ)
|
listbucket.CreationDate = bucket.Created.Format(timeFormatAMZLong)
|
||||||
listbuckets = append(listbuckets, listbucket)
|
listbuckets = append(listbuckets, listbucket)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +304,7 @@ func generateListObjectsV1Response(bucket, prefix, marker, delimiter string, max
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
content.Key = object.Name
|
content.Key = object.Name
|
||||||
content.LastModified = object.ModTime.UTC().Format(timeFormatAMZ)
|
content.LastModified = object.ModTime.UTC().Format(timeFormatAMZLong)
|
||||||
if object.MD5Sum != "" {
|
if object.MD5Sum != "" {
|
||||||
content.ETag = "\"" + object.MD5Sum + "\""
|
content.ETag = "\"" + object.MD5Sum + "\""
|
||||||
}
|
}
|
||||||
@ -350,7 +351,7 @@ func generateListObjectsV2Response(bucket, prefix, token, startAfter, delimiter
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
content.Key = object.Name
|
content.Key = object.Name
|
||||||
content.LastModified = object.ModTime.UTC().Format(timeFormatAMZ)
|
content.LastModified = object.ModTime.UTC().Format(timeFormatAMZLong)
|
||||||
if object.MD5Sum != "" {
|
if object.MD5Sum != "" {
|
||||||
content.ETag = "\"" + object.MD5Sum + "\""
|
content.ETag = "\"" + object.MD5Sum + "\""
|
||||||
}
|
}
|
||||||
@ -384,7 +385,7 @@ func generateListObjectsV2Response(bucket, prefix, token, startAfter, delimiter
|
|||||||
func generateCopyObjectResponse(etag string, lastModified time.Time) CopyObjectResponse {
|
func generateCopyObjectResponse(etag string, lastModified time.Time) CopyObjectResponse {
|
||||||
return CopyObjectResponse{
|
return CopyObjectResponse{
|
||||||
ETag: "\"" + etag + "\"",
|
ETag: "\"" + etag + "\"",
|
||||||
LastModified: lastModified.UTC().Format(timeFormatAMZ),
|
LastModified: lastModified.UTC().Format(timeFormatAMZLong),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,7 +432,7 @@ func generateListPartsResponse(partsInfo ListPartsInfo) ListPartsResponse {
|
|||||||
newPart.PartNumber = part.PartNumber
|
newPart.PartNumber = part.PartNumber
|
||||||
newPart.ETag = "\"" + part.ETag + "\""
|
newPart.ETag = "\"" + part.ETag + "\""
|
||||||
newPart.Size = part.Size
|
newPart.Size = part.Size
|
||||||
newPart.LastModified = part.LastModified.UTC().Format(timeFormatAMZ)
|
newPart.LastModified = part.LastModified.UTC().Format(timeFormatAMZLong)
|
||||||
listPartsResponse.Parts[index] = newPart
|
listPartsResponse.Parts[index] = newPart
|
||||||
}
|
}
|
||||||
return listPartsResponse
|
return listPartsResponse
|
||||||
@ -461,7 +462,7 @@ func generateListMultipartUploadsResponse(bucket string, multipartsInfo ListMult
|
|||||||
newUpload := Upload{}
|
newUpload := Upload{}
|
||||||
newUpload.UploadID = upload.UploadID
|
newUpload.UploadID = upload.UploadID
|
||||||
newUpload.Key = upload.Object
|
newUpload.Key = upload.Object
|
||||||
newUpload.Initiated = upload.Initiated.UTC().Format(timeFormatAMZ)
|
newUpload.Initiated = upload.Initiated.UTC().Format(timeFormatAMZLong)
|
||||||
listMultipartUploadsResponse.Uploads[index] = newUpload
|
listMultipartUploadsResponse.Uploads[index] = newUpload
|
||||||
}
|
}
|
||||||
return listMultipartUploadsResponse
|
return listMultipartUploadsResponse
|
||||||
|
Loading…
x
Reference in New Issue
Block a user