Skip to content

_ls_from_cache: weird behavior regarding comparisons with trailing slash #554

Closed
@isidentical

Description

@isidentical

In this example, the path is stripped only for the contain check. When dircache contains the normalized version (a/b) but not a/b/ it will throw a KeyError though it probably shouldn't since this is what that check appears to be stand for. Another case is right below that code that compares the normalized version with the obtained one from the cache, which might not be normalized. So I was wondering whether this is intentional or should we use .rstrip() in both of the cases (self.dircache[path.rstrip('/')], f["name"].rstrip("/") == path.rstrip("/"))
https://github.com/intake/filesystem_spec/blob/6ee47aa6c10868c383be5cb13837f2a26a099f5d/fsspec/spec.py#L342-L343
https://github.com/intake/filesystem_spec/blob/6ee47aa6c10868c383be5cb13837f2a26a099f5d/fsspec/spec.py#L349

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions