1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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 <me@gereonfrey.de> (github: gfrey)
This commit is contained in:
Gereon Frey 2014-01-17 08:44:18 +01:00
parent 20f36f088c
commit 4f53722dee

View file

@ -630,7 +630,13 @@ func (b *buildFile) Build(context io.Reader) (string, error) {
if err != nil { if err != nil {
return "", err 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 { if err := archive.Untar(b.context, tmpdirPath, nil); err != nil {
return "", err return "", err
} }