File tree Expand file tree Collapse file tree 1 file changed +17
-10
lines changed
bioimageio/spec/_internal Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -873,23 +873,30 @@ def validate_suffix(
873873
874874 if isinstance (strict , (HttpUrl , AnyUrl )):
875875 if strict .path is None or "." not in (path := strict .path ):
876- actual_suffix = ""
877- elif (
878- strict .host == "zenodo.org"
879- and path .startswith ("/api/records/" )
880- and path .endswith ("/content" )
881- ):
882- actual_suffix = "." + path [: - len ("/content" )].split ("." )[- 1 ]
876+ actual_suffixes = []
883877 else :
884- actual_suffix = "." + path .split ("." )[- 1 ]
878+ if (
879+ strict .host == "zenodo.org"
880+ and path .startswith ("/api/records/" )
881+ and path .endswith ("/content" )
882+ ):
883+ # Zenodo API URLs have a "/content" suffix that should be ignored
884+ path = path [: - len ("/content" )]
885+
886+ actual_suffixes = [f".{ path .split ('.' )[- 1 ]} " ]
885887
886888 elif isinstance (strict , PurePath ):
887- actual_suffix = strict .suffixes [ - 1 ]
889+ actual_suffixes = strict .suffixes
888890 elif isinstance (strict , RelativeFilePath ):
889- actual_suffix = strict .path .suffixes [ - 1 ]
891+ actual_suffixes = strict .path .suffixes
890892 else :
891893 assert_never (strict )
892894
895+ if actual_suffixes :
896+ actual_suffix = actual_suffixes [- 1 ]
897+ else :
898+ actual_suffix = "no suffix"
899+
893900 if (
894901 case_sensitive
895902 and actual_suffix not in suffixes
You can’t perform that action at this time.
0 commit comments