Skip to content

BUG: formatPartPath silently maps empty path to '1' #1113

@andrinoff

Description

@andrinoff

Describe the bug

fetcher/fetcher.go:224-227:

func formatPartPath(path []int) string {
    if len(path) == 0 {
        return "1"
    }
    ...

Returning "1" for an empty path masks bugs in the caller (a Walk that produced no path is almost certainly wrong) and conflicts with parsePartID, which treats "" and "TEXT" as nil and "1" as a real path of length 1.

Expected behavior

Return "" (matching parsePartID's nil-path convention) and let the caller decide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions