diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-03-15 04:16:00 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-03-15 04:16:00 -0700 |
| commit | f9b3750ad16e0907ad488a0daf249828fc6011f6 (patch) | |
| tree | 59a3186b99331c61e774200950ba1d6aeba89506 | |
| parent | 22400c66331e90fd5aa430c243af2eadfdfe9b12 (diff) | |
| download | seaweedfs-f9b3750ad16e0907ad488a0daf249828fc6011f6.tar.xz seaweedfs-f9b3750ad16e0907ad488a0daf249828fc6011f6.zip | |
volume: handle repeated writes response
| -rw-r--r-- | weed/operation/upload_content.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.go index 0fc3c37bf..75775d7d0 100644 --- a/weed/operation/upload_content.go +++ b/weed/operation/upload_content.go @@ -188,12 +188,17 @@ func upload_content(uploadUrl string, fillBufferFunction func(w io.Writer) error return nil, post_err } defer resp.Body.Close() + + var ret UploadResult etag := getEtag(resp) + if resp.StatusCode == http.StatusNoContent { + ret.ETag = etag + return &ret, nil + } resp_body, ra_err := ioutil.ReadAll(resp.Body) if ra_err != nil { return nil, ra_err } - var ret UploadResult unmarshal_err := json.Unmarshal(resp_body, &ret) if unmarshal_err != nil { glog.V(0).Infoln("failing to read upload response", uploadUrl, string(resp_body)) |
