diff --git a/src/anemoi/registry/commands/entry.py b/src/anemoi/registry/commands/entry.py index bbc4ca1..1aa8196 100644 --- a/src/anemoi/registry/commands/entry.py +++ b/src/anemoi/registry/commands/entry.py @@ -86,9 +86,10 @@ def check_arguments(self, args): def run(self, args): path = args.path - if "/" not in path: + if "/" not in path[1:] or not path.startswith("/"): raise ValueError("Invalid API path {path}") - collection, *_ = path.split("/") + + _, collection, *_ = path.split("/") if collection not in ("datasets", "experiments", "weights", "queues"): LOG.warning(f"Unknown collection {collection}") @@ -192,7 +193,7 @@ def load(self, args): LOG.error(f"Entry in {args.path} does not exists. Using --create to create it.") raise ValueError(f"Entry in {args.path} does not exists. Using --create to create it.") - collection, _ = args.path.split("/") + _, collection, *_ = args.path.split("/") res = rest.post(collection, edited) LOG.info(f"Entry in {collection} has been created : {res}.")