fix whitespace that precedes the escape in a multiline string.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
This commit is contained in:
Erik Hollensbe 2014-06-24 23:54:53 -07:00
parent 01d4fd76dd
commit 03c5c1930d
2 changed files with 25 additions and 1 deletions

View File

@ -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 <io@\
docker.com>"
`, true)
res, err := inspectField(name, "Author")
if err != nil {
t.Fatal(err)
}
if res != "Docker IO <io@docker.com>" {
t.Fatal("Parsed string did not match the escaped string")
}
logDone("build - validate escaping whitespace")
}

View File

@ -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")