Skip to content

Commit

Permalink
Improve metadata URL parsing
Browse files Browse the repository at this point in the history
Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
  • Loading branch information
sechkova committed Nov 17, 2021
1 parent 15e458c commit 01859d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/repository_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ def fetch(self, url: str) -> Iterator[bytes]:
if path.startswith("/metadata/") and path.endswith(".json"):
# figure out rolename and version
ver_and_name = path[len("/metadata/") :][: -len(".json")]
version, _, role = ver_and_name.partition(".")
# root is always version-prefixed while timestamp is always NOT
if ver_and_name.endswith("root") or (
if role == "root" or (
self.root.consistent_snapshot and ver_and_name != "timestamp"
):
version, _, role = ver_and_name.partition(".")
version = int(version)
else:
# the file is not version-prefixed
Expand Down

0 comments on commit 01859d5

Please sign in to comment.