From bbbb9f39caf83abcca56be6f405770147db4863b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Larivi=C3=A8re?= Date: Wed, 25 Feb 2026 11:03:06 -0500 Subject: [PATCH] fix(entries): filter root-level entries client-side when path is empty --- VERSION | 2 +- entries.go | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 6633391..249afd5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.18.0 +0.18.1 diff --git a/entries.go b/entries.go index 7bb847d..3c2bf20 100644 --- a/entries.go +++ b/entries.go @@ -206,7 +206,7 @@ func (c *Client) getEntries(ctx context.Context, vaultId string, opts GetEntries if opts.Name != nil { q.Set("name", *opts.Name) } - if opts.Path != nil { + if opts.Path != nil && *opts.Path != "" { q.Set("path", *opts.Path) } q.Set("page", fmt.Sprintf("%d", currentPage)) @@ -241,5 +241,17 @@ func (c *Client) getEntries(ctx context.Context, vaultId string, opts GetEntries currentPage++ } + // When path is explicitly set to "", the server ignores the filter and returns all entries. + // We apply client-side filtering to return only root-level entries (entries with no path). + if opts.Path != nil && *opts.Path == "" { + var rootEntries []Entry + for _, entry := range allEntries { + if entry.Path == "" { + rootEntries = append(rootEntries, entry) + } + } + return rootEntries, nil + } + return allEntries, nil }