@@ -161,9 +161,8 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
161
161
162
162
let config = Config :: current ( ) ;
163
163
let ( org, project) = config. get_org_and_project ( matches) ?;
164
- let base_url = config. get_base_url ( ) ?;
165
164
166
- let mut uploaded_paths_and_ids = vec ! [ ] ;
165
+ let mut uploaded_paths_and_urls = vec ! [ ] ;
167
166
let mut errored_paths_and_reasons = vec ! [ ] ;
168
167
for ( path, zip) in normalized_zips {
169
168
info ! ( "Uploading file: {}" , path. display( ) ) ;
@@ -186,9 +185,9 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
186
185
build_configuration,
187
186
& vcs_info,
188
187
) {
189
- Ok ( artifact_id ) => {
188
+ Ok ( artifact_url ) => {
190
189
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 ) ) ;
192
191
}
193
192
Err ( e) => {
194
193
debug ! ( "Failed to upload file at path {}: {}" , path. display( ) , e) ;
@@ -212,22 +211,21 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
212
211
}
213
212
}
214
213
215
- if uploaded_paths_and_ids . is_empty ( ) {
214
+ if uploaded_paths_and_urls . is_empty ( ) {
216
215
bail ! ( "Failed to upload any files" ) ;
217
216
} else {
218
217
println ! (
219
218
"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 {
222
221
""
223
222
} else {
224
223
"s"
225
224
}
226
225
) ;
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( ) ) ;
231
229
}
232
230
}
233
231
}
@@ -337,7 +335,7 @@ fn handle_directory(path: &Path) -> Result<TempFile> {
337
335
normalize_directory ( path, temp_dir. path ( ) )
338
336
}
339
337
340
- /// Returns artifact id if upload was successful.
338
+ /// Returns artifact url if upload was successful.
341
339
fn upload_file (
342
340
api : & AuthenticatedApi ,
343
341
bytes : & [ u8 ] ,
@@ -390,15 +388,16 @@ fn upload_file(
390
388
// In the normal case we go through this loop exactly twice:
391
389
// 1. state=not_found
392
390
// 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)
394
392
//
395
393
// In the case where all the chunks are already on the server we go
396
394
// through only once:
397
- // 1. state=ok, artifact_id set
395
+ // 1. state=created, artifact_url set
398
396
//
399
397
// In the case where something went wrong (which could be on either
400
398
// iteration of the loop) we get:
401
- // n. state=err, artifact_id unset
399
+ // n. state=error, artifact_url unset
400
+
402
401
let result = loop {
403
402
let response = api. assemble_mobile_app (
404
403
org,
@@ -425,14 +424,12 @@ fn upload_file(
425
424
bail ! ( "Failed to process uploaded files: {}" , message) ;
426
425
}
427
426
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 ) ;
430
429
}
431
430
432
431
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" ) ;
436
433
}
437
434
} ;
438
435
0 commit comments