Skip to content

Commit b58c668

Browse files
authored
Handle situations where unique part of the url is in the query. (#769)
* Handle situations where unique part of the url is in the query. If present, include query part to generated basename in normalizeFilesDirs. * Use the whole (quoted) url for default basename of non-file references. * Check nonempty scheme
1 parent ef4f399 commit b58c668

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cwltool/pathmapper.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ def addLocation(d):
7272
d["location"] = urllib.parse.urlunparse((parse.scheme, parse.netloc, path, parse.params, parse.query, parse.fragment))
7373

7474
if "basename" not in d:
75-
d["basename"] = os.path.basename(urllib.request.url2pathname(path))
75+
if parse.scheme and parse.scheme != "file":
76+
d["basename"] = urllib.parse.quote(parse.netloc + parse.path, safe="")
77+
if parse.query:
78+
d["basename"] += urllib.parse.quote("?"+parse.query, safe="")
79+
else:
80+
d["basename"] = os.path.basename(urllib.request.url2pathname(path))
7681

7782
if d["class"] == "File":
7883
d["nameroot"], d["nameext"] = os.path.splitext(d["basename"])

0 commit comments

Comments
 (0)