diff --git a/scripts/common/constants.py b/scripts/common/constants.py index d98f9e77..af60d8fb 100644 --- a/scripts/common/constants.py +++ b/scripts/common/constants.py @@ -1,5 +1,5 @@ JSON_ENDING = ".json" -BASE64_ENDING = ".base64" +BASE64_ENDING = ".base64.json" ZIP_ENDING = ".zip" VALID_INPUT_ENDINGS = [ JSON_ENDING, BASE64_ENDING ] diff --git a/scripts/common/get_data.py b/scripts/common/get_data.py index 8f105fe2..a5ad5656 100644 --- a/scripts/common/get_data.py +++ b/scripts/common/get_data.py @@ -37,8 +37,11 @@ def decode_and_unzip(base64_zip_path): TEMP_DIR_NAME, os.path.basename(base64_zip_path).replace(BASE64_ENDING, '.zip')) with open(zip_path, 'wb') as zip_file: - with open(base64_zip_path, 'rb') as input_file: - base64.decode(input_file, zip_file) + with open(base64_zip_path, 'r') as input_file: + file_content = json.load(input_file) + base64_content = file_content['data']['base64'] + zip_content = base64.b64decode(base64_content) + zip_file.write(zip_content) wrong_zip_content_text = '[ERROR] Please make sure that the zipped input ' \ 'archive holds exactly one file with "{}" extension'.format(JSON_ENDING) with zipfile.ZipFile(zip_path) as zip_file: