Use canonicalETag helper wherever needed. (#3910)

This commit is contained in:
Harshavardhana 2017-03-15 20:48:49 -07:00 committed by GitHub
parent ae4361cc45
commit 6509589adb
3 changed files with 4 additions and 7 deletions

View File

@ -25,7 +25,6 @@ import (
"path"
"sort"
"strconv"
"strings"
mux "github.com/gorilla/mux"
)
@ -874,8 +873,7 @@ func (api objectAPIHandlers) CompleteMultipartUploadHandler(w http.ResponseWrite
// Complete parts.
var completeParts []completePart
for _, part := range complMultipartUpload.Parts {
part.ETag = strings.TrimPrefix(part.ETag, "\"")
part.ETag = strings.TrimSuffix(part.ETag, "\"")
part.ETag = canonicalizeETag(part.ETag)
completeParts = append(completeParts, part)
}

View File

@ -26,7 +26,6 @@ import (
"net/http/httptest"
"net/url"
"strconv"
"strings"
"sync"
"testing"
@ -1037,7 +1036,7 @@ func testAPICopyObjectPartHandlerSanity(obj ObjectLayer, instanceType, bucketNam
parts = append(parts, completePart{
PartNumber: partNumber,
ETag: strings.Trim(resp.ETag, "\""),
ETag: canonicalizeETag(resp.ETag),
})
}

View File

@ -2579,10 +2579,10 @@ func (s *TestSuiteCommon) TestObjectMultipart(c *C) {
c.Assert(response.StatusCode, Equals, http.StatusOK)
var parts []completePart
for _, part := range completeUploads.Parts {
part.ETag = strings.Trim(part.ETag, "\"")
part.ETag = canonicalizeETag(part.ETag)
parts = append(parts, part)
}
etag, err := getCompleteMultipartMD5(parts)
c.Assert(err, IsNil)
c.Assert(strings.Trim(response.Header.Get("Etag"), "\""), Equals, etag)
c.Assert(canonicalizeETag(response.Header.Get("Etag")), Equals, etag)
}