diff --git a/.gitignore b/.gitignore index 975287e9..4baa4a10 100644 --- a/.gitignore +++ b/.gitignore @@ -137,6 +137,9 @@ venv.bak/ .spyderproject .spyproject +# VS Code settings +.vscode/ + # Rope project settings .ropeproject diff --git a/polarion_rest_api_client/data_models.py b/polarion_rest_api_client/data_models.py index 4a5582e4..b018a814 100644 --- a/polarion_rest_api_client/data_models.py +++ b/polarion_rest_api_client/data_models.py @@ -112,15 +112,18 @@ def calculate_checksum(self) -> str: attachments = data.pop("attachments") + for attachment in attachments: + try: + attachment["content_bytes"] = attachment[ + "content_bytes" + ].decode("utf-8") + except AttributeError: + pass + data = dict(sorted(data.items())) converted = json.dumps(data).encode("utf8") - converted_attachments = json.dumps(attachments).encode("utf8") - self._checksum = ( - hashlib.sha256(converted).hexdigest() - + " " - + hashlib.sha256(converted_attachments).hexdigest() - ) + self._checksum = hashlib.sha256(converted).hexdigest() return self._checksum def get_current_checksum(self) -> str | None: