From 03c5c1930d884f0052b4940643fa5b4fc57bdea7 Mon Sep 17 00:00:00 2001 From: Erik Hollensbe Date: Tue, 24 Jun 2014 23:54:53 -0700 Subject: [PATCH] fix whitespace that precedes the escape in a multiline string. Docker-DCO-1.1-Signed-off-by: Erik Hollensbe (github: erikh) --- integration-cli/docker_cli_build_test.go | 24 ++++++++++++++++++++++++ server/buildfile.go | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index 48075912b4..6086258d10 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -1490,3 +1490,27 @@ func TestBuildAddToSymlinkDest(t *testing.T) { } logDone("build - add to symlink destination") } + +func TestBuildEscapeWhitespace(t *testing.T) { + name := "testbuildescaping" + defer deleteImages(name) + + _, err := buildImage(name, ` + FROM busybox + MAINTAINER "Docker \ +IO " + `, true) + + res, err := inspectField(name, "Author") + + if err != nil { + t.Fatal(err) + } + + if res != "Docker IO " { + t.Fatal("Parsed string did not match the escaped string") + } + + logDone("build - validate escaping whitespace") +} diff --git a/server/buildfile.go b/server/buildfile.go index 5b94c9423a..f10cc0dbc5 100644 --- a/server/buildfile.go +++ b/server/buildfile.go @@ -761,7 +761,7 @@ func (b *buildFile) commit(id string, autoCmd []string, comment string) error { } // Long lines can be split with a backslash -var lineContinuation = regexp.MustCompile(`\s*\\\s*\n`) +var lineContinuation = regexp.MustCompile(`\\\s*\n`) func (b *buildFile) Build(context io.Reader) (string, error) { tmpdirPath, err := ioutil.TempDir("", "docker-build")