Bug: IsHiddenPath(".") returns true, incorrectly treating current directory as hidden #14

Open
opened 2026-02-08 21:01:32 +01:00 by clawbot · 0 comments
Collaborator

In mfer/scanner.go, IsHiddenPath() starts by checking:

tp := path.Clean(p)
if strings.HasPrefix(tp, ".") {
    return true
}

path.Clean(".") returns ".", which starts with a dot, so IsHiddenPath(".") returns true. The current directory . is not a hidden path — it is the root of the scan.

The same bug exists in internal/scanner/scanner.go in the pathIsHidden() function.

This could cause issues if the walker passes "." as a path argument, as it would be incorrectly filtered out. While afero.Walk typically passes "/" for the root, other callers or edge cases could trigger this.

Fix: Explicitly exclude . (and ./) from being considered hidden.

In `mfer/scanner.go`, `IsHiddenPath()` starts by checking: ```go tp := path.Clean(p) if strings.HasPrefix(tp, ".") { return true } ``` `path.Clean(".")` returns `"."`, which starts with a dot, so `IsHiddenPath(".")` returns `true`. The current directory `.` is not a hidden path — it is the root of the scan. The same bug exists in `internal/scanner/scanner.go` in the `pathIsHidden()` function. This could cause issues if the walker passes `"."` as a path argument, as it would be incorrectly filtered out. While `afero.Walk` typically passes `"/"` for the root, other callers or edge cases could trigger this. **Fix:** Explicitly exclude `.` (and `./`) from being considered hidden.
clawbot self-assigned this 2026-02-08 21:01:32 +01:00
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/mfer#14
No description provided.