From f88eb559113f7ba897f3b477c08f4cdce61854c5 Mon Sep 17 00:00:00 2001 From: jiuker <2818723467@qq.com> Date: Sat, 30 Dec 2023 01:16:55 +0800 Subject: [PATCH] fix: tree traversal issue with empty folders (#4810) fixes #4794 --- cmd/tree-main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/tree-main.go b/cmd/tree-main.go index c6de205f..c2080930 100644 --- a/cmd/tree-main.go +++ b/cmd/tree-main.go @@ -195,6 +195,16 @@ func doTree(ctx context.Context, url string, timeRef time.Time, level int, branc prefixPath = strings.TrimPrefix(prefixPath, "."+separator) if prev.Type.IsDir() { + nextURL := "" + if targetAlias != "" { + nextURL = targetAlias + "/" + contentURL + } else { + nextURL = contentURL + } + + if nextURL == url { + return nil + } printMsg(treeMessage{ Entry: strings.TrimSuffix(strings.TrimPrefix(contentURL, prefixPath), "/"), IsDir: true,