X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2c3a6a67bc01241f57e815f4f7e4678bd6eadb03..22f9af1104fa45e95ef3cd8b5a770fc0b9ed0fd3:/sdk/cwl/arvados_cwl/http.py diff --git a/sdk/cwl/arvados_cwl/http.py b/sdk/cwl/arvados_cwl/http.py index ccc2e793b0..dcc2a51192 100644 --- a/sdk/cwl/arvados_cwl/http.py +++ b/sdk/cwl/arvados_cwl/http.py @@ -16,6 +16,7 @@ import arvados.collection import urllib.parse import logging import calendar +import urllib.parse logger = logging.getLogger('arvados.cwl-runner') @@ -132,7 +133,7 @@ def http_to_keep(api, project_uuid, url, utcnow=datetime.datetime.utcnow): count = 0 start = time.time() checkpoint = start - with c.open(name, "w") as f: + with c.open(name, "wb") as f: for chunk in req.iter_content(chunk_size=1024): count += len(chunk) f.write(chunk) @@ -148,7 +149,9 @@ def http_to_keep(api, project_uuid, url, utcnow=datetime.datetime.utcnow): logger.info("%d downloaded, %3.2f MiB/s", count, (bps / (1024*1024))) checkpoint = loopnow - c.save_new(name="Downloaded from %s" % url, owner_uuid=project_uuid, ensure_unique_name=True) + + collectionname = "Downloaded from %s" % urllib.parse.quote(url, safe='') + c.save_new(name=collectionname, owner_uuid=project_uuid, ensure_unique_name=True) api.collections().update(uuid=c.manifest_locator(), body={"collection":{"properties": properties}}).execute()