diff --git a/src/commands/debug_files/upload.rs b/src/commands/debug_files/upload.rs index 83cbf568a9..db04bb6f74 100644 --- a/src/commands/debug_files/upload.rs +++ b/src/commands/debug_files/upload.rs @@ -270,6 +270,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { upload.include_sources(matches.get_flag("include_sources")); upload.il2cpp_mapping(matches.get_flag("il2cpp_mapping")); + upload.no_upload(matches.get_flag("no_upload")); // Configure BCSymbolMap resolution, if possible if let Some(symbol_map) = matches.get_one::("symbol_maps") { @@ -288,11 +289,6 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { } } - if matches.get_flag("no_upload") { - println!("{} skipping upload.", style(">").dim()); - return Ok(()); - } - // Execute the upload let (uploaded, has_processing_errors) = upload.upload()?; diff --git a/src/utils/dif_upload/mod.rs b/src/utils/dif_upload/mod.rs index c4d046c33b..a12d4693b1 100644 --- a/src/utils/dif_upload/mod.rs +++ b/src/utils/dif_upload/mod.rs @@ -1254,6 +1254,11 @@ fn upload_difs_chunked( Chunked::from(m, chunk_options.chunk_size as usize) })?; + if options.no_upload { + println!("{} skipping upload.", style(">").dim()); + return Ok(Default::default()); + } + let options = options.into_chunk_options(chunk_options); chunks::upload_chunked_objects(&chunked, options) } @@ -1359,6 +1364,10 @@ fn upload_difs_batched(options: &DifUpload) -> Result> { println!("{} Nothing to upload", style(">").dim()); return Ok(Default::default()); } + if options.no_upload { + println!("{} skipping upload.", style(">").dim()); + return Ok(Default::default()); + } // Upload missing DIFs in batches let uploaded = upload_in_batches(&missing, options)?; @@ -1448,6 +1457,7 @@ pub struct DifUpload<'a> { wait: bool, upload_il2cpp_mappings: bool, il2cpp_mappings_allowed: bool, + no_upload: bool, } impl<'a> DifUpload<'a> { @@ -1488,6 +1498,7 @@ impl<'a> DifUpload<'a> { wait: false, upload_il2cpp_mappings: false, il2cpp_mappings_allowed: false, + no_upload: false, } } @@ -1599,6 +1610,14 @@ impl<'a> DifUpload<'a> { self } + /// Set whether to skip uploading the detected debug files for troubleshooting purposes. + /// + /// Defaults to `false`. + pub fn no_upload(&mut self, skip: bool) -> &mut Self { + self.no_upload = skip; + self + } + /// Performs the search for DIFs and uploads them. /// /// ``` diff --git a/tests/integration/_cases/debug_files/upload/debug_files-upload-no-upload.trycmd b/tests/integration/_cases/debug_files/upload/debug_files-upload-no-upload.trycmd index dd09da5d4e..80f12ff4a7 100644 --- a/tests/integration/_cases/debug_files/upload/debug_files-upload-no-upload.trycmd +++ b/tests/integration/_cases/debug_files/upload/debug_files-upload-no-upload.trycmd @@ -1,6 +1,8 @@ ``` $ sentry-cli debug-files upload tests/integration/_fixtures/elf-Linux-ARMv7-ls --no-upload ? success +> Found 1 debug information file +> Prepared debug information file for upload > skipping upload. ``` diff --git a/tests/integration/debug_files/upload.rs b/tests/integration/debug_files/upload.rs index 5f060294f7..2ae7ba2a28 100644 --- a/tests/integration/debug_files/upload.rs +++ b/tests/integration/debug_files/upload.rs @@ -157,7 +157,8 @@ fn command_debug_files_upload_no_upload() { ) .with_response_file("debug_files/post-difs-assemble.json"), ) - .register_trycmd_test("debug_files/upload/debug_files-upload-no-upload.trycmd"); + .register_trycmd_test("debug_files/upload/debug_files-upload-no-upload.trycmd") + .with_default_token(); } #[test]