Skip to content

Commit f8092da

Browse files
Fix load_document_by_uri method
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`.
1 parent b926e33 commit f8092da

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

cwl_utils/parser/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,6 @@ def load_document_by_uri(
232232
load_all: bool = False,
233233
) -> Any:
234234
"""Load a CWL object from a URI or a path."""
235-
base_uri = ""
236-
real_uri = ""
237235
if isinstance(path, str):
238236
uri = urlparse(path)
239237
id_ = uri.fragment or None
@@ -248,8 +246,9 @@ def load_document_by_uri(
248246
base_uri = path.resolve().parent.as_uri()
249247
id_ = path.resolve().name.split("#")[1] if "#" in path.resolve().name else None
250248

251-
if loadingOptions is None:
252-
loadingOptions = cwl_v1_2.LoadingOptions(fileuri=real_uri, baseuri=base_uri)
249+
loadingOptions = cwl_v1_2.LoadingOptions(
250+
fileuri=real_uri, baseuri=base_uri, copyfrom=loadingOptions
251+
)
253252

254253
doc = loadingOptions.fetcher.fetch_text(real_uri)
255254
return load_document_by_string(doc, real_uri, loadingOptions, id_, load_all)

0 commit comments

Comments
 (0)