Check error returned from io.Copy

Signed-off-by: Stephen J Day <stephen.day@docker.com>
pull/499/head
Stephen J Day 2015-04-22 12:12:59 -07:00 committed by Richard
parent 3020aa0fe8
commit bccca791ad
1 changed files with 5 additions and 1 deletions

View File

@ -198,7 +198,11 @@ func (luh *layerUploadHandler) PutLayerUploadComplete(w http.ResponseWriter, r *
// may miss a root cause.
// Read in the final chunk, if any.
io.Copy(luh.Upload, r.Body)
if _, err := io.Copy(luh.Upload, r.Body); err != nil {
ctxu.GetLogger(luh).Errorf("unknown error copying into upload: %v", err)
w.WriteHeader(http.StatusInternalServerError)
luh.Errors.Push(v2.ErrorCodeUnknown, err)
}
layer, err := luh.Upload.Finish(dgst)
if err != nil {