For the Object Storage API, further describe subdir marker and delimiter
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openstack-api-site |
Fix Released
|
Medium
|
Laura Clymer |
Bug Description
Reported via doc comment:
When a request uses `format` and `path` together, the server returns a `subdir` object for each directory-like entry.
Consider this setup:
a/foo.txt
a/b/bar.txt
Now a request is issued with these params: ?prefix=
The resulting JSON data will look like this:
[
{"name": "a/foo.txt", ...}
{"subdir": "a/b/"}
]
The subdir can then be used to construct a new prefix to simulate a directory listing of `a/b/`.
The `delimiter` param does not seem to have any effect when combined with `path`.
Say I have a list of objects like this (no directory marker files):
a/b/c/foo.txt
a/bar.txt
To be really directory-like, I should be able to view the "contents" of "a/b". Setting path=a/
Changed in openstack-api-site: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
summary: |
- For the Object Storage API, further describe subdir maker and delimiter + For the Object Storage API, further describe subdir marker and delimiter |
Changed in openstack-api-site: | |
status: | Confirmed → Triaged |
Changed in openstack-api-site: | |
assignee: | nobody → Suzanna Schulze (suzannaschulze) |
tags: | added: api |
tags: | added: swift |
Changed in openstack-api-site: | |
status: | Triaged → In Progress |
You probably should use the prefix parameter, rather than path. Setting prefix and delimiter resolves this for me: prefix "a/b/" and delimiter "/". This will return all objects that start with a/b/ and truncate to "/".
The documentation does mention that setting path is equivalent to setting prefix to "path" + "/" and delimiter to "/" (http:// developer. openstack. org/api- ref-objectstora ge-v1.html# showContainerDe tails).
Note, however, that you may run into a relate issue: https:/ /bugs.launchpad .net/swift/ +bug/1475018
Essentially, if you create keys that start with "/" and want to list the contents under "/", it will not honor the delimiter setting and will list all keys in the container.