diff --git a/logical/framework/path_map.go b/logical/framework/path_map.go index d17e8f235..ff1d27770 100644 --- a/logical/framework/path_map.go +++ b/logical/framework/path_map.go @@ -106,7 +106,7 @@ func (p *PathMap) Paths() []*Path { return []*Path{ &Path{ - Pattern: fmt.Sprintf("%s/%s$", p.Prefix, p.Name), + Pattern: fmt.Sprintf("%s/%s/?$", p.Prefix, p.Name), Callbacks: map[logical.Operation]OperationFunc{ logical.ListOperation: p.pathList, @@ -137,7 +137,7 @@ func (p *PathMap) Paths() []*Path { func (p *PathMap) pathList( req *logical.Request, d *FieldData) (*logical.Response, error) { - keys, err := req.Storage.List(req.Path) + keys, err := p.List(req.Storage, "") if err != nil { return nil, err } diff --git a/logical/framework/path_map_test.go b/logical/framework/path_map_test.go index c80e710dd..7d30d7dd8 100644 --- a/logical/framework/path_map_test.go +++ b/logical/framework/path_map_test.go @@ -65,6 +65,20 @@ func TestPathMap(t *testing.T) { t.Fatalf("bad: %#v", keys) } + // LIST via HTTP + resp, err = b.HandleRequest(&logical.Request{ + Operation: logical.ListOperation, + Path: "map/foo/", + Storage: storage, + }) + if err != nil { + t.Fatalf("bad: %#v", err) + } + if len(resp.Data) != 1 || len(resp.Data["keys"].([]string)) != 1 || + resp.Data["keys"].([]string)[0] != "a" { + t.Fatalf("bad: %#v", resp) + } + // Delete via HTTP resp, err = b.HandleRequest(&logical.Request{ Operation: logical.DeleteOperation,