From e45a006d619eeb99e3997be2117077b0c82f2ae8 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Fri, 10 Nov 2017 16:30:08 -0800 Subject: [PATCH] clearly state that url is wrong at validation stage of build --- common/config.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/config.go b/common/config.go index cc7eced6a..02b214902 100644 --- a/common/config.go +++ b/common/config.go @@ -131,5 +131,12 @@ func DownloadableURL(original string) (string, error) { return "", fmt.Errorf("Unsupported URL scheme: %s", url.Scheme) } + // if cleaned filepath does not exist, error out now. + if url.Scheme == "file" { + if _, err := os.Stat(url.Path); err != nil { + return "", fmt.Errorf("The filepath doesn't exist either as a "+ + "relative or an absolute path: %s", err) + } + } return url.String(), nil }