mirror of https://github.com/minio/minio.git
				
				
				
			Switching from base64 to hex for etag
This commit is contained in:
		
							parent
							
								
									211b084e50
								
							
						
					
					
						commit
						1a88b36c55
					
				| 
						 | 
				
			
			@ -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