Merge pull request #1633 from justinsb/file_urls

Recognize file:// urls
This commit is contained in:
Kris Nova 2017-01-27 04:57:44 -07:00 committed by GitHub
commit 08f7a73dc9
1 changed files with 3 additions and 2 deletions

View File

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