@@ -161,9 +161,8 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
161161
162162 let config = Config :: current ( ) ;
163163 let ( org, project) = config. get_org_and_project ( matches) ?;
164- let base_url = config. get_base_url ( ) ?;
165164
166- let mut uploaded_paths_and_ids = vec ! [ ] ;
165+ let mut uploaded_paths_and_urls = vec ! [ ] ;
167166 let mut errored_paths_and_reasons = vec ! [ ] ;
168167 for ( path, zip) in normalized_zips {
169168 info ! ( "Uploading file: {}" , path. display( ) ) ;
@@ -186,9 +185,9 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
186185 build_configuration,
187186 & vcs_info,
188187 ) {
189- Ok ( artifact_id ) => {
188+ Ok ( artifact_url ) => {
190189 info ! ( "Successfully uploaded file: {}" , path. display( ) ) ;
191- uploaded_paths_and_ids . push ( ( path. to_path_buf ( ) , artifact_id ) ) ;
190+ uploaded_paths_and_urls . push ( ( path. to_path_buf ( ) , artifact_url ) ) ;
192191 }
193192 Err ( e) => {
194193 debug ! ( "Failed to upload file at path {}: {}" , path. display( ) , e) ;
@@ -212,22 +211,21 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
212211 }
213212 }
214213
215- if uploaded_paths_and_ids . is_empty ( ) {
214+ if uploaded_paths_and_urls . is_empty ( ) {
216215 bail ! ( "Failed to upload any files" ) ;
217216 } else {
218217 println ! (
219218 "Successfully uploaded {} file{} to Sentry" ,
220- uploaded_paths_and_ids . len( ) ,
221- if uploaded_paths_and_ids . len( ) == 1 {
219+ uploaded_paths_and_urls . len( ) ,
220+ if uploaded_paths_and_urls . len( ) == 1 {
222221 ""
223222 } else {
224223 "s"
225224 }
226225 ) ;
227- if uploaded_paths_and_ids. len ( ) < 3 {
228- for ( path, artifact_id) in & uploaded_paths_and_ids {
229- let url = format ! ( "{base_url}/{org}/preprod/{project}/{artifact_id}" ) ;
230- println ! ( " - {} ({url})" , path. display( ) ) ;
226+ if uploaded_paths_and_urls. len ( ) < 3 {
227+ for ( path, artifact_url) in & uploaded_paths_and_urls {
228+ println ! ( " - {} ({artifact_url})" , path. display( ) ) ;
231229 }
232230 }
233231 }
@@ -337,7 +335,7 @@ fn handle_directory(path: &Path) -> Result<TempFile> {
337335 normalize_directory ( path, temp_dir. path ( ) )
338336}
339337
340- /// Returns artifact id if upload was successful.
338+ /// Returns artifact url if upload was successful.
341339fn upload_file (
342340 api : & AuthenticatedApi ,
343341 bytes : & [ u8 ] ,
@@ -390,15 +388,16 @@ fn upload_file(
390388 // In the normal case we go through this loop exactly twice:
391389 // 1. state=not_found
392390 // server tells us the we need to send every chunk and we do so
393- // 2. artifact_id set so we're done (likely state=created)
391+ // 2. artifact_url set so we're done (likely state=created)
394392 //
395393 // In the case where all the chunks are already on the server we go
396394 // through only once:
397- // 1. state=ok, artifact_id set
395+ // 1. state=created, artifact_url set
398396 //
399397 // In the case where something went wrong (which could be on either
400398 // iteration of the loop) we get:
401- // n. state=err, artifact_id unset
399+ // n. state=error, artifact_url unset
400+
402401 let result = loop {
403402 let response = api. assemble_mobile_app (
404403 org,
@@ -425,14 +424,12 @@ fn upload_file(
425424 bail ! ( "Failed to process uploaded files: {}" , message) ;
426425 }
427426
428- if let Some ( artifact_id ) = response. artifact_id {
429- break Ok ( artifact_id ) ;
427+ if let Some ( artifact_url ) = response. artifact_url {
428+ break Ok ( artifact_url ) ;
430429 }
431430
432431 if response. state . is_finished ( ) {
433- bail ! (
434- "File upload is_finished() but did not succeeded (returning artifact_id) or error"
435- ) ;
432+ bail ! ( "File upload is_finished() but did not succeeded or error" ) ;
436433 }
437434 } ;
438435
0 commit comments