Skip to content
Permalink
Browse files
Add check that path is not empty.
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 aeb877223cb3c67ad7f9fc25cd3cef25800f8db7
Showing 1 changed file with 4 additions and 0 deletions.
@@ -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

0 comments on commit aeb8772

Please sign in to comment.