volume: handle repeated writes response
This commit is contained in:
@@ -188,12 +188,17 @@ func upload_content(uploadUrl string, fillBufferFunction func(w io.Writer) error
|
|||||||
return nil, post_err
|
return nil, post_err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
var ret UploadResult
|
||||||
etag := getEtag(resp)
|
etag := getEtag(resp)
|
||||||
|
if resp.StatusCode == http.StatusNoContent {
|
||||||
|
ret.ETag = etag
|
||||||
|
return &ret, nil
|
||||||
|
}
|
||||||
resp_body, ra_err := ioutil.ReadAll(resp.Body)
|
resp_body, ra_err := ioutil.ReadAll(resp.Body)
|
||||||
if ra_err != nil {
|
if ra_err != nil {
|
||||||
return nil, ra_err
|
return nil, ra_err
|
||||||
}
|
}
|
||||||
var ret UploadResult
|
|
||||||
unmarshal_err := json.Unmarshal(resp_body, &ret)
|
unmarshal_err := json.Unmarshal(resp_body, &ret)
|
||||||
if unmarshal_err != nil {
|
if unmarshal_err != nil {
|
||||||
glog.V(0).Infoln("failing to read upload response", uploadUrl, string(resp_body))
|
glog.V(0).Infoln("failing to read upload response", uploadUrl, string(resp_body))
|
||||||
|
|||||||
Reference in New Issue
Block a user