Skip to content

Commit

Permalink
Merge pull request #548 from bioimage-io/fix-filenames-zenodo
Browse files Browse the repository at this point in the history
fixed `RawNodeTransformer` to resolve names of files hosted on zenodo properly
  • Loading branch information
FynnBe authored Jan 23, 2024
2 parents e5f56b6 + 2978438 commit 0dd0de7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bioimageio/spec/shared/node_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit 0dd0de7

Please sign in to comment.