Skip to content

Commit 4600bbd

Browse files
committed
avoid basedir append to http/https input file path
1 parent e67ce7c commit 4600bbd

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

cwltool/pathmapper.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,13 @@ def visit(self, obj, stagedir, basedir, copy=False, staged=False):
210210
with SourceLine(obj, "location", validate.ValidationException):
211211
# Dereference symbolic links
212212
deref = ab
213-
st = os.lstat(deref)
214-
while stat.S_ISLNK(st.st_mode):
215-
rl = os.readlink(deref)
216-
deref = rl if os.path.isabs(rl) else os.path.join(
217-
os.path.dirname(deref), rl)
213+
if urllib.parse.urlsplit(deref).scheme not in ['http','https']:
218214
st = os.lstat(deref)
215+
while stat.S_ISLNK(st.st_mode):
216+
rl = os.readlink(deref)
217+
deref = rl if os.path.isabs(rl) else os.path.join(
218+
os.path.dirname(deref), rl)
219+
st = os.lstat(deref)
219220
self._pathmap[path] = MapperEnt(deref, tgt, "WritableFile" if copy else "File", staged)
220221
self.visitlisting(obj.get("secondaryFiles", []), stagedir, basedir, copy=copy, staged=staged)
221222

cwltool/stdfsaccess.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
def abspath(src, basedir): # type: (Text, Text) -> Text
1414
if src.startswith(u"file://"):
1515
ab = six.text_type(uri_file_path(str(src)))
16+
elif urllib.parse.urlsplit(src).scheme in ['http','https']:
17+
return src
1618
else:
1719
if basedir.startswith(u"file://"):
1820
ab = src if os.path.isabs(src) else basedir+ '/'+ src

0 commit comments

Comments
 (0)