浏览代码

add more searchable info to the error message when ADD tries to go outside the context

Sven Dowideit 11 年之前
父节点
当前提交
96b5be9dd9
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      buildfile.go
  2. 1 1
      integration/buildfile_test.go

+ 1 - 1
buildfile.go

@@ -288,7 +288,7 @@ func (b *buildFile) addContext(container *Container, orig, dest string) error {
 		destPath = destPath + "/"
 	}
 	if !strings.HasPrefix(origPath, b.context) {
-		return fmt.Errorf("Forbidden path: %s", origPath)
+		return fmt.Errorf("Forbidden path outside the build context: %s (%s)", orig, origPath)
 	}
 	fi, err := os.Stat(origPath)
 	if err != nil {

+ 1 - 1
integration/buildfile_test.go

@@ -483,7 +483,7 @@ func TestForbiddenContextPath(t *testing.T) {
 		t.Fail()
 	}
 
-	if err.Error() != "Forbidden path: /" {
+	if err.Error() != "Forbidden path outside the build context: ../../ (/)" {
 		t.Logf("Error message is not expected: %s", err.Error())
 		t.Fail()
 	}