From 96b5be9dd9606a9bfbf0fdbe98bcaf8b6e77e4b1 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Thu, 14 Nov 2013 15:19:31 +1000 Subject: [PATCH] add more searchable info to the error message when ADD tries to go outside the context --- buildfile.go | 2 +- integration/buildfile_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildfile.go b/buildfile.go index ce157302f6..b643af509d 100644 --- a/buildfile.go +++ b/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 { diff --git a/integration/buildfile_test.go b/integration/buildfile_test.go index 964b58403b..20d0450a7c 100644 --- a/integration/buildfile_test.go +++ b/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() }