Skip to content

[Hi-lvl Python SDK] Reference.objects() does not list CommonPrefixes of subdirectories #7230

Open
@nicholasjng

Description

@nicholasjng

Happy new year!

The following was a bit surprising to me. I was implementing directory caching of object listings, and saw that CommonPrefix objects are included in the output of Reference.objects() calls. Nice! That way, I can group everything below a prefix into a cache entry.

But sub-prefixes are not included: For example, in the sample data repository, if I listed all objects from root (i.e. .objects(prefix="/")), the images/ folder would not appear as a common prefix. Is this intended? I basically now resort to computing the remaining other directories by taking the set of all parent prefixes of the resulting files.

Short diagram:

print(o for o in Branch().objects(prefix="/"))

------------------------------
CommonPrefix(path="/") <- root prefix whose listing I requested.
ObjectInfo(path="README.md", ...)
...
ObjectInfo(path="images/img01.jpg", ...)  <-- I expected a sub-prefix like CommonPrefix(path="images") in front.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions