Skip to content

Commit c170b00

Browse files
committed
Avoid checksum generation when not desired
1 parent be1de3b commit c170b00

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

pyartifactory/objects/artifact.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,17 @@ def deploy(
102102
if properties is not None:
103103
properties_param_str = ";".join(f"{k}={value}" for k, values in properties.items() for value in values)
104104
route = ";".join(s for s in [artifact_folder.as_posix(), properties_param_str] if s)
105-
artifact_check_sums = Checksums.generate(local_file)
106-
headers = {
107-
"X-Checksum-Sha1": artifact_check_sums.sha1,
108-
"X-Checksum-Sha256": artifact_check_sums.sha256,
109-
"X-Checksum": artifact_check_sums.md5,
110-
}
105+
headers: Dict[str, str] = {}
111106
if checksum_enabled:
112-
headers["X-Checksum-Deploy"] = "true"
107+
artifact_check_sums = Checksums.generate(local_file)
108+
headers.update(
109+
{
110+
"X-Checksum-Sha1": artifact_check_sums.sha1,
111+
"X-Checksum-Sha256": artifact_check_sums.sha256,
112+
"X-Checksum": artifact_check_sums.md5,
113+
"X-Checksum-Deploy": "true",
114+
},
115+
)
113116
try:
114117
self._put(
115118
route=route,

0 commit comments

Comments
 (0)