Skip to content

Commit

Permalink
Add check that path is not empty.
Browse files Browse the repository at this point in the history
This avoids a panic in a case like br catalog add file://test.zip,
if you forget to add the path to the file, file:///some/path/test.zip.
  • Loading branch information
geomacy committed Apr 27, 2017
1 parent c745579 commit aeb8772
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cli/api/catalog/catalog.go
Expand Up @@ -233,8 +233,12 @@ func AddCatalog(network *net.Network, resource string) (map[string]models.Catalo

if "" == u.Scheme || "file" == u.Scheme {
if "file" == u.Scheme {
if u.Path == "" {
return nil, errors.New("No resource in 'file:' URL: " + resource)
}
resource = u.Path
}

file, err := os.Open(filepath.Clean(resource))
if err != nil {
return nil, err
Expand Down

0 comments on commit aeb8772

Please sign in to comment.