Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with normalized paths when importing from a WDL JSON file #5121

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
8 changes: 6 additions & 2 deletions src/toil/wdl/wdltoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
from typing import NotRequired
from mypy_extensions import Arg, DefaultArg
from urllib.error import HTTPError
from urllib.parse import quote, unquote, urljoin, urlsplit
from urllib.parse import quote, unquote, urljoin, urlsplit, urlparse
from functools import partial

import WDL.Error
Expand Down Expand Up @@ -1318,7 +1318,11 @@ def _virtualize_filename(self, filename: str) -> str:
else:
# Otherwise this is a local file and we want to fake it as a Toil file store file
# Make it an absolute path
if self.execution_dir is not None:
parsed = urlparse(filename)
if parsed.scheme == "file":
# conversion was already done by normalize_uri
abs_filename = unquote(parsed.path)
elif self.execution_dir is not None:
# To support relative paths from execution directory, join the execution dir and filename
# If filename is already an abs path, join() will not do anything
abs_filename = os.path.join(self.execution_dir, filename)
Expand Down