diff options
author | 2022-03-04 10:01:29 +0100 | |
---|---|---|
committer | 2022-03-04 12:20:23 +0100 | |
commit | 27519b08b0978a9ef92f4d337d5eb7d6643445ff (patch) | |
tree | 397813ef8905c8a346839d3e1cb3a4432f118a14 /xtesting/core | |
parent | 76909625027772102e0a174c17bce5490f8a8fcf (diff) |
Protect vs Bucket containing html chars
It allows dumping MTS output files.
Change-Id: I2b35ee81a764573a9d17cb3a225cb5febed5fa46
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'xtesting/core')
-rw-r--r-- | xtesting/core/campaign.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/xtesting/core/campaign.py b/xtesting/core/campaign.py index 2c16dfac..66f8182c 100644 --- a/xtesting/core/campaign.py +++ b/xtesting/core/campaign.py @@ -127,19 +127,22 @@ class Campaign(): prefix = os.path.join(s3path, build_tag) # pylint: disable=no-member for s3_object in b3resource.Bucket(bucket_name).objects.filter( - Prefix="{}/".format(prefix)): - path, _ = os.path.split(s3_object.key) - lpath = re.sub('^{}/*'.format(s3path), '', path) + Prefix=f"{prefix}/"): + path, _ = os.path.split( + urllib.parse.unquote_plus(s3_object.key)) + lpath = re.sub(f'^{s3path}/*', '', path) if lpath and not os.path.exists(lpath): os.makedirs(lpath) + Campaign.__logger.info( + "Downloading %s", + re.sub(f'^{s3path}/*', '', + urllib.parse.unquote_plus(s3_object.key))) # pylint: disable=no-member b3resource.Bucket(bucket_name).download_file( - s3_object.key, - re.sub(f'^{s3path}/*', '', s3_object.key), + urllib.parse.unquote_plus(s3_object.key), + re.sub(f'^{s3path}/*', '', + urllib.parse.unquote_plus(s3_object.key)), Config=tconfig) - Campaign.__logger.info( - "Downloading %s", - re.sub('^{}/*'.format(s3path), '', s3_object.key)) return Campaign.EX_OK except Exception: # pylint: disable=broad-except Campaign.__logger.exception("Cannot publish the artifacts") |