Repository: brooklyn-client Updated Branches: refs/heads/master c74557918 -> 6d5574af6
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. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/aeb87722 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/aeb87722 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/aeb87722 Branch: refs/heads/master Commit: aeb877223cb3c67ad7f9fc25cd3cef25800f8db7 Parents: c745579 Author: Geoff Macartney <[email protected]> Authored: Thu Apr 27 10:45:41 2017 +0100 Committer: Geoff Macartney <[email protected]> Committed: Thu Apr 27 10:47:35 2017 +0100 ---------------------------------------------------------------------- cli/api/catalog/catalog.go | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/aeb87722/cli/api/catalog/catalog.go ---------------------------------------------------------------------- diff --git a/cli/api/catalog/catalog.go b/cli/api/catalog/catalog.go index 5cfefc3..7a422e2 100644 --- a/cli/api/catalog/catalog.go +++ b/cli/api/catalog/catalog.go @@ -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
