From ee212e5b52958dfd21ce3f2f52d061898a687cb2 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 13 Oct 2015 17:22:51 -0700 Subject: [PATCH] Relax strict ETag requirement for Get and Head requests --- .../minio/minio-go-legacy/api-core.go | 32 ------------------- vendor/github.com/minio/minio-go/api-core.go | 32 ------------------- vendor/vendor.json | 8 ++--- 3 files changed, 4 insertions(+), 68 deletions(-) diff --git a/vendor/github.com/minio/minio-go-legacy/api-core.go b/vendor/github.com/minio/minio-go-legacy/api-core.go index 475482be..64ab8374 100644 --- a/vendor/github.com/minio/minio-go-legacy/api-core.go +++ b/vendor/github.com/minio/minio-go-legacy/api-core.go @@ -494,14 +494,6 @@ func (a apiCore) putObjectUnAuthenticated(bucket, object, contentType string, si } var metadata ObjectStat metadata.ETag = strings.Trim(resp.Header.Get("ETag"), "\"") // trim off the odd double quotes - if metadata.ETag == "" { - return ObjectStat{}, ErrorResponse{ - Code: "InternalError", - Message: "Missing Etag, please report this issue at https://github.com/minio/minio-go-legacy/issues", - RequestID: resp.Header.Get("x-amz-request-id"), - HostID: resp.Header.Get("x-amz-id-2"), - } - } return metadata, nil } @@ -545,14 +537,6 @@ func (a apiCore) putObject(bucket, object, contentType string, md5SumBytes []byt } var metadata ObjectStat metadata.ETag = strings.Trim(resp.Header.Get("ETag"), "\"") // trim off the odd double quotes - if metadata.ETag == "" { - return ObjectStat{}, ErrorResponse{ - Code: "InternalError", - Message: "Missing Etag, please report this issue at https://github.com/minio/minio-go-legacy/issues", - RequestID: resp.Header.Get("x-amz-request-id"), - HostID: resp.Header.Get("x-amz-id-2"), - } - } return metadata, nil } @@ -669,14 +653,6 @@ func (a apiCore) getObject(bucket, object string, offset, length int64) (io.Read } } md5sum := strings.Trim(resp.Header.Get("ETag"), "\"") // trim off the odd double quotes - if md5sum == "" { - return nil, ObjectStat{}, ErrorResponse{ - Code: "InternalError", - Message: "Missing Etag, please report this issue at https://github.com/minio/minio-go-legacy/issues", - RequestID: resp.Header.Get("x-amz-request-id"), - HostID: resp.Header.Get("x-amz-id-2"), - } - } date, err := time.Parse(http.TimeFormat, resp.Header.Get("Last-Modified")) if err != nil { return nil, ObjectStat{}, ErrorResponse{ @@ -824,14 +800,6 @@ func (a apiCore) headObject(bucket, object string) (ObjectStat, error) { } } md5sum := strings.Trim(resp.Header.Get("ETag"), "\"") // trim off the odd double quotes - if md5sum == "" { - return ObjectStat{}, ErrorResponse{ - Code: "InternalError", - Message: "Missing Etag, please report this issue at https://github.com/minio/minio-go-legacy/issues", - RequestID: resp.Header.Get("x-amz-request-id"), - HostID: resp.Header.Get("x-amz-id-2"), - } - } size, err := strconv.ParseInt(resp.Header.Get("Content-Length"), 10, 64) if err != nil { return ObjectStat{}, ErrorResponse{ diff --git a/vendor/github.com/minio/minio-go/api-core.go b/vendor/github.com/minio/minio-go/api-core.go index 08544464..f632fb29 100644 --- a/vendor/github.com/minio/minio-go/api-core.go +++ b/vendor/github.com/minio/minio-go/api-core.go @@ -494,14 +494,6 @@ func (a apiCore) putObjectUnAuthenticated(bucket, object, contentType string, si } var metadata ObjectStat metadata.ETag = strings.Trim(resp.Header.Get("ETag"), "\"") // trim off the odd double quotes - if metadata.ETag == "" { - return ObjectStat{}, ErrorResponse{ - Code: "InternalError", - Message: "Missing Etag, please report this issue at https://github.com/minio/minio-go/issues", - RequestID: resp.Header.Get("x-amz-request-id"), - HostID: resp.Header.Get("x-amz-id-2"), - } - } return metadata, nil } @@ -545,14 +537,6 @@ func (a apiCore) putObject(bucket, object, contentType string, md5SumBytes []byt } var metadata ObjectStat metadata.ETag = strings.Trim(resp.Header.Get("ETag"), "\"") // trim off the odd double quotes - if metadata.ETag == "" { - return ObjectStat{}, ErrorResponse{ - Code: "InternalError", - Message: "Missing Etag, please report this issue at https://github.com/minio/minio-go/issues", - RequestID: resp.Header.Get("x-amz-request-id"), - HostID: resp.Header.Get("x-amz-id-2"), - } - } return metadata, nil } @@ -672,14 +656,6 @@ func (a apiCore) getObject(bucket, object string, offset, length int64) (io.Read } } md5sum := strings.Trim(resp.Header.Get("ETag"), "\"") // trim off the odd double quotes - if md5sum == "" { - return nil, ObjectStat{}, ErrorResponse{ - Code: "InternalError", - Message: "Missing Etag, please report this issue at https://github.com/minio/minio-go/issues", - RequestID: resp.Header.Get("x-amz-request-id"), - HostID: resp.Header.Get("x-amz-id-2"), - } - } date, err := time.Parse(http.TimeFormat, resp.Header.Get("Last-Modified")) if err != nil { return nil, ObjectStat{}, ErrorResponse{ @@ -827,14 +803,6 @@ func (a apiCore) headObject(bucket, object string) (ObjectStat, error) { } } md5sum := strings.Trim(resp.Header.Get("ETag"), "\"") // trim off the odd double quotes - if md5sum == "" { - return ObjectStat{}, ErrorResponse{ - Code: "InternalError", - Message: "Missing Etag, please report this issue at https://github.com/minio/minio-go/issues", - RequestID: resp.Header.Get("x-amz-request-id"), - HostID: resp.Header.Get("x-amz-id-2"), - } - } size, err := strconv.ParseInt(resp.Header.Get("Content-Length"), 10, 64) if err != nil { return ObjectStat{}, ErrorResponse{ diff --git a/vendor/vendor.json b/vendor/vendor.json index 724b2672..3808dbf8 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -29,13 +29,13 @@ }, { "path": "github.com/minio/minio-go", - "revision": "c031bbe3dd5e304e0f0bd154d97615fade8df23b", - "revisionTime": "2015-10-13T10:12:53-07:00" + "revision": "866c42f9e3ad89bf44f3527082a788166c385f5e", + "revisionTime": "2015-10-13T17:03:11-07:00" }, { "path": "github.com/minio/minio-go-legacy", - "revision": "49580a230a441dda8eedbf4440f15a4b3018a385", - "revisionTime": "2015-10-13T10:07:00-07:00" + "revision": "0e894de484c4e4ff39f36320b7153b7f57d395b9", + "revisionTime": "2015-10-13T17:08:05-07:00" }, { "path": "github.com/minio/minio/pkg/probe",