mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
Merge pull request #311 from fkautz/pr_out_switching_from_base64_to_hex_for_etag
This commit is contained in:
commit
d99435963b
@ -32,8 +32,6 @@ import (
|
||||
mstorage "github.com/minio-io/minio/pkg/storage"
|
||||
"github.com/minio-io/minio/pkg/storage/memory"
|
||||
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
@ -364,10 +362,7 @@ func (s *MySuite) TestDateFormat(c *C) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
func verifyHeaders(c *C, header http.Header, date time.Time, size int, contentType string, md5String string) {
|
||||
md5Sum, err := hex.DecodeString(md5String)
|
||||
etag := base64.StdEncoding.EncodeToString(md5Sum)
|
||||
c.Assert(err, IsNil)
|
||||
func verifyHeaders(c *C, header http.Header, date time.Time, size int, contentType string, etag string) {
|
||||
// Verify date
|
||||
c.Assert(header.Get("Last-Modified"), Equals, date.Format(time.RFC1123))
|
||||
|
||||
|
@ -24,8 +24,6 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
mstorage "github.com/minio-io/minio/pkg/storage"
|
||||
)
|
||||
|
||||
@ -64,8 +62,7 @@ func writeObjectHeaders(w http.ResponseWriter, metadata mstorage.ObjectMetadata)
|
||||
lastModified := metadata.Created.Format(time.RFC1123)
|
||||
// common headers
|
||||
writeCommonHeaders(w, metadata.ContentType)
|
||||
md5Bytes, _ := hex.DecodeString(metadata.Md5)
|
||||
w.Header().Set("ETag", base64.StdEncoding.EncodeToString(md5Bytes))
|
||||
w.Header().Set("ETag", metadata.Md5)
|
||||
w.Header().Set("Last-Modified", lastModified)
|
||||
w.Header().Set("Content-Length", strconv.FormatInt(metadata.Size, 10))
|
||||
w.Header().Set("Connection", "close")
|
||||
@ -76,8 +73,7 @@ func writeRangeObjectHeaders(w http.ResponseWriter, metadata mstorage.ObjectMeta
|
||||
lastModified := metadata.Created.Format(time.RFC1123)
|
||||
// common headers
|
||||
writeCommonHeaders(w, metadata.ContentType)
|
||||
md5Bytes, _ := hex.DecodeString(metadata.Md5)
|
||||
w.Header().Set("ETag", base64.StdEncoding.EncodeToString(md5Bytes))
|
||||
w.Header().Set("ETag", metadata.Md5)
|
||||
w.Header().Set("Last-Modified", lastModified)
|
||||
w.Header().Set("Content-Range", ra)
|
||||
w.Header().Set("Content-Length", strconv.FormatInt(metadata.Size, 10))
|
||||
|
@ -19,7 +19,6 @@ package minioapi
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"encoding/hex"
|
||||
mstorage "github.com/minio-io/minio/pkg/storage"
|
||||
)
|
||||
|
||||
@ -90,8 +89,7 @@ func generateObjectsListResult(bucket string, objects []mstorage.ObjectMetadata,
|
||||
}
|
||||
content.Key = object.Key
|
||||
content.LastModified = object.Created.Format(iso8601Format)
|
||||
md5Bytes, _ := hex.DecodeString(object.Md5)
|
||||
content.ETag = hex.EncodeToString(md5Bytes)
|
||||
content.ETag = object.Md5
|
||||
content.Size = object.Size
|
||||
content.StorageClass = "STANDARD"
|
||||
content.Owner = owner
|
||||
|
Loading…
Reference in New Issue
Block a user