From 4318d69af30c288ee3a095155730b8a5bd92f481 Mon Sep 17 00:00:00 2001 From: Sergii Kabashniuk Date: Sun, 29 Jan 2017 15:01:53 +0200 Subject: [PATCH] Fixes work of inspectResponse in case of ContentLength=-1 Signed-off-by: Sergii Kabashniuk Upstream-commit: 22a9ec009b24f567e1feaeb32da25d6b2792c92a Component: engine --- components/engine/builder/remote.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/builder/remote.go b/components/engine/builder/remote.go index f3a4329d16..b790301619 100644 --- a/components/engine/builder/remote.go +++ b/components/engine/builder/remote.go @@ -129,7 +129,7 @@ func inspectResponse(ct string, r io.ReadCloser, clen int64) (string, io.ReadClo return ct, r, err } - preambleR := bytes.NewReader(preamble) + preambleR := bytes.NewReader(preamble[:rlen]) bodyReader := ioutil.NopCloser(io.MultiReader(preambleR, r)) // Some web servers will use application/octet-stream as the default // content type for files without an extension (e.g. 'Dockerfile')