From 4f53722dee6c8ea18a9c30bde2cc6fee24b03d32 Mon Sep 17 00:00:00 2001 From: Gereon Frey Date: Fri, 17 Jan 2014 08:44:18 +0100 Subject: [PATCH] detect compressed archives in API /build call AFAIK in some previous version it was possible to give a compressed docker file to the API's build command and that was handled properly (aka compression was detected and archive uncompressed accordingly). Fails with at least 0.7.5. Fixed this using the DecompressStream method from the archive package. Docker-DCO-1.1-Signed-off-by: Gereon Frey (github: gfrey) --- buildfile.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/buildfile.go b/buildfile.go index 2b6d40c15d..19249b04c4 100644 --- a/buildfile.go +++ b/buildfile.go @@ -630,7 +630,13 @@ func (b *buildFile) Build(context io.Reader) (string, error) { if err != nil { return "", err } - b.context = &utils.TarSum{Reader: context, DisableCompression: true} + + decompressedStream, err := archive.DecompressStream(context) + if err != nil { + return "", err + } + + b.context = &utils.TarSum{Reader: decompressedStream, DisableCompression: true} if err := archive.Untar(b.context, tmpdirPath, nil); err != nil { return "", err }