Skip to content

Commit c070c8f

Browse files
committed
Fix ETag
1 parent f781b1d commit c070c8f

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

s3util/uploader.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ func (u *uploader) putPart(p *part) error {
194194
if len(s) < 2 {
195195
return fmt.Errorf("received invalid etag %q", s)
196196
}
197+
p.ETag = s[1 : len(s)-1]
197198
return nil
198199
}
199200

s3util/uploader_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ func runUpload(t *testing.T, makeCloser func(io.Reader) io.ReadCloser) *uploader
1919
case req.Method == "POST" && q["uploads"] != nil:
2020
s = `<UploadId>foo</UploadId>`
2121
case req.Method == "POST" && q["uploadId"] != nil:
22+
b, _ := ioutil.ReadAll(req.Body)
23+
if !strings.Contains(string(b), "<ETag>foo</ETag>") {
24+
t.Error("missing ETag")
25+
}
2226
default:
2327
t.Fatal("unexpected request", req)
2428
}

0 commit comments

Comments
 (0)