From 7217b4a4b9ba05176a7382d6408923067b31b330 Mon Sep 17 00:00:00 2001 From: Scott Wittenburg Date: Wed, 24 Oct 2018 15:22:59 -0600 Subject: [PATCH] Make sure to urlencode cdash submit parameters --- lib/spack/spack/reporters/cdash.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/spack/spack/reporters/cdash.py b/lib/spack/spack/reporters/cdash.py index 2f74e4ec0d..38ed96a448 100644 --- a/lib/spack/spack/reporters/cdash.py +++ b/lib/spack/spack/reporters/cdash.py @@ -14,6 +14,7 @@ import xml.sax.saxutils from six import text_type from six.moves.urllib.request import build_opener, HTTPHandler, Request +from six.moves.urllib.parse import urlencode import spack.build_environment import spack.fetch_strategy @@ -197,9 +198,14 @@ def upload(self, filename): buildid_regexp = re.compile("([0-9]+)") opener = build_opener(HTTPHandler) with open(filename, 'rb') as f: - url = "{0}&build={1}&site={2}&stamp={3}&MD5={4}".format( - self.cdash_upload_url, self.buildname, self.site, - self.buildstamp, md5sum) + params_dict = { + 'build': self.buildname, + 'site': self.site, + 'stamp': self.buildstamp, + 'MD5': md5sum, + } + encoded_params = urlencode(params_dict) + url = "{0}&{1}".format(self.cdash_upload_url, encoded_params) request = Request(url, data=f) request.add_header('Content-Type', 'text/xml') request.add_header('Content-Length', os.path.getsize(filename))