mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #2692 from SvenDowideit/add-specific-feedback-for-bad-ADD
Add specific feedback for ADD outside context
This commit is contained in:
commit
926f7b579e
2 changed files with 2 additions and 2 deletions
|
@ -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 {
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue