forked from TrueCloudLab/distribution
Merge pull request #414 from stevvooe/check-error-copy
Check error returned from io.Copy
This commit is contained in:
commit
e59046e598
1 changed files with 5 additions and 1 deletions
|
@ -198,7 +198,11 @@ func (luh *layerUploadHandler) PutLayerUploadComplete(w http.ResponseWriter, r *
|
||||||
// may miss a root cause.
|
// may miss a root cause.
|
||||||
|
|
||||||
// Read in the final chunk, if any.
|
// 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)
|
layer, err := luh.Upload.Finish(dgst)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue