@@ -98,17 +98,22 @@ def deploy(
9898 for file in files :
9999 self .deploy (Path (f"{ root } /{ file } " ), Path (f"{ new_root } /{ file } " ), properties , checksum_enabled )
100100 else :
101+ properties_param_str = ""
102+ if properties is not None :
103+ properties_param_str = ";" .join (f"{ k } ={ value } " for k , values in properties .items () for value in values )
104+ 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+ }
101111 if checksum_enabled :
102- artifact_check_sums = Checksums . generate ( local_file )
112+ headers [ "X-Checksum-Deploy" ] = "true"
103113 try :
104114 self ._put (
105- route = artifact_folder .as_posix (),
106- headers = {
107- "X-Checksum-Deploy" : "true" ,
108- "X-Checksum-Sha1" : artifact_check_sums .sha1 ,
109- "X-Checksum-Sha256" : artifact_check_sums .sha256 ,
110- "X-Checksum" : artifact_check_sums .md5 ,
111- },
115+ route = route ,
116+ headers = headers ,
112117 )
113118 except requests .exceptions .HTTPError as error :
114119 if error .response .status_code == 404 :
@@ -120,12 +125,9 @@ def deploy(
120125 raise ArtifactNotFoundError (message )
121126 raise ArtifactoryError from error
122127 else :
128+ headers ["X-Checksum-Deploy" ] = "false"
123129 with local_file .open ("rb" ) as stream :
124- properties_param_str = ""
125- if properties is not None :
126- properties_param_str = self ._format_properties (properties )
127- route = ";" .join (s for s in [artifact_folder .as_posix (), properties_param_str ] if s )
128- self ._put (route , data = stream )
130+ self ._put (route = route , headers = headers , data = stream )
129131
130132 logger .debug ("Artifact %s successfully deployed" , local_file )
131133 return self .info (artifact_folder )
0 commit comments