소스 검색

fix whitespace that precedes the escape in a multiline string.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Erik Hollensbe 11 년 전
부모
커밋
03c5c1930d
2개의 변경된 파일25개의 추가작업 그리고 1개의 파일을 삭제
  1. 24 0
      integration-cli/docker_cli_build_test.go
  2. 1 1
      server/buildfile.go

+ 24 - 0
integration-cli/docker_cli_build_test.go

@@ -1490,3 +1490,27 @@ func TestBuildAddToSymlinkDest(t *testing.T) {
 	}
 	}
 	logDone("build - add to symlink destination")
 	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")
+}

+ 1 - 1
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
 // 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) {
 func (b *buildFile) Build(context io.Reader) (string, error) {
 	tmpdirPath, err := ioutil.TempDir("", "docker-build")
 	tmpdirPath, err := ioutil.TempDir("", "docker-build")