Skip to content

Commit

Permalink
Fix load_document_by_uri method
Browse files Browse the repository at this point in the history
This commit adjusts the `load_document_by_uri` method, ensuring that the
`LoadingOptions` object used to parse the document contains the correct
values for `fileuri` and `baseuri`.
  • Loading branch information
GlassOfWhiskey committed Dec 17, 2024
1 parent b926e33 commit f8092da
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cwl_utils/parser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ def load_document_by_uri(
load_all: bool = False,
) -> Any:
"""Load a CWL object from a URI or a path."""
base_uri = ""
real_uri = ""
if isinstance(path, str):
uri = urlparse(path)
id_ = uri.fragment or None
Expand All @@ -248,8 +246,9 @@ def load_document_by_uri(
base_uri = path.resolve().parent.as_uri()
id_ = path.resolve().name.split("#")[1] if "#" in path.resolve().name else None

if loadingOptions is None:
loadingOptions = cwl_v1_2.LoadingOptions(fileuri=real_uri, baseuri=base_uri)
loadingOptions = cwl_v1_2.LoadingOptions(
fileuri=real_uri, baseuri=base_uri, copyfrom=loadingOptions
)

doc = loadingOptions.fetcher.fetch_text(real_uri)
return load_document_by_string(doc, real_uri, loadingOptions, id_, load_all)
Expand Down

0 comments on commit f8092da

Please sign in to comment.