From bb42ae672345b6197f1c46244afaac59d7f00f64 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Wed, 25 Jan 2017 23:13:31 -0500 Subject: [PATCH] Recognize file:// urls --- util/pkg/vfs/context.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/pkg/vfs/context.go b/util/pkg/vfs/context.go index 1af425f34c..1d44f3692a 100644 --- a/util/pkg/vfs/context.go +++ b/util/pkg/vfs/context.go @@ -44,7 +44,7 @@ var Context = VFSContext{ // metadata: reads from instance metadata on GCE/AWS // http / https: reads from HTTP func (c *VFSContext) ReadFile(location string) ([]byte, error) { - if strings.Contains(location, "://") { + if strings.Contains(location, "://") && !strings.HasPrefix(location, "file://") { // Handle our special case schemas u, err := url.Parse(location) if err != nil { @@ -70,9 +70,10 @@ func (c *VFSContext) ReadFile(location string) ([]byte, error) { case "http", "https": return c.readHttpLocation(location, nil) } - } + location = strings.TrimPrefix(location, "file://") + p, err := c.BuildVfsPath(location) if err != nil { return nil, err