소스 검색

Merge pull request #2692 from SvenDowideit/add-specific-feedback-for-bad-ADD

Add specific feedback for ADD outside context
Victor Vieux 11 년 전
부모
커밋
926f7b579e
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 + "/"
 		destPath = destPath + "/"
 	}
 	}
 	if !strings.HasPrefix(origPath, b.context) {
 	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)
 	fi, err := os.Stat(origPath)
 	if err != nil {
 	if err != nil {

+ 1 - 1
integration/buildfile_test.go

@@ -483,7 +483,7 @@ func TestForbiddenContextPath(t *testing.T) {
 		t.Fail()
 		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.Logf("Error message is not expected: %s", err.Error())
 		t.Fail()
 		t.Fail()
 	}
 	}