diff --git a/bioimageio/spec/shared/node_transformer.py b/bioimageio/spec/shared/node_transformer.py index cc834a397..b328e94a6 100644 --- a/bioimageio/spec/shared/node_transformer.py +++ b/bioimageio/spec/shared/node_transformer.py @@ -197,7 +197,14 @@ def _transform_resource( resource = self.root / resource elif isinstance(resource, URI): - name_from = pathlib.PurePath(resource.path or "unknown") + if ( + resource.authority == "zenodo.org" + and resource.path.startswith("/api/records/") + and resource.path.endswith("/content") + ): + name_from = pathlib.PurePath(resource.path[: -len("/content")].strip("/")) + else: + name_from = pathlib.PurePath(resource.path or "unknown") folder_in_package = "" else: raise TypeError(f"Unexpected type {type(resource)} for {resource}")