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

Upstream-commit: 96b5be9dd9606a9bfbf0fdbe98bcaf8b6e77e4b1
Component: engine
This commit is contained in:
Sven Dowideit
2013-11-14 15:19:31 +10:00
committed by Sven Dowideit
parent a3e03a0c52
commit 2f447b8d32
2 changed files with 2 additions and 2 deletions

View File

@ -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 {

View File

@ -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()
}