Skip to content

Commit dfc6dd6

Browse files
authored
fix(sourcemaps): Exclude skipped files from bundle file count (#2397)
closes #2136
1 parent c7919f5 commit dfc6dd6

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

src/utils/file_upload.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,8 @@ fn build_artifact_bundle(
510510
bundle.set_attribute("dist".to_owned(), dist.to_owned());
511511
}
512512

513+
let mut bundle_file_count = 0;
514+
513515
for file in files.values() {
514516
pb.inc(1);
515517
pb.set_message(&file.url);
@@ -533,6 +535,7 @@ fn build_artifact_bundle(
533535
return Err(e.into());
534536
}
535537
}
538+
bundle_file_count += 1;
536539
}
537540

538541
bundle.finish()?;
@@ -542,8 +545,8 @@ fn build_artifact_bundle(
542545
println!(
543546
"{} Bundled {} {} for upload",
544547
style(">").dim(),
545-
style(files.len()).yellow(),
546-
match files.len() {
548+
style(bundle_file_count).yellow(),
549+
match bundle_file_count {
547550
1 => "file",
548551
_ => "files",
549552
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
```
2+
$ sentry-cli sourcemaps upload tests/integration/_fixtures/invalid-utf8.txt tests/integration/_fixtures/bundle.min.js.map
3+
? success
4+
...
5+
> Bundled 1 file for upload
6+
...
7+
8+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
��

tests/integration/sourcemaps/upload.rs

+8
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,11 @@ fn command_sourcemaps_upload_complex_extension() {
183183
.register_trycmd_test("sourcemaps/sourcemaps-upload-complex-extension.trycmd")
184184
.with_default_token();
185185
}
186+
187+
#[test]
188+
fn command_sourcemaps_upload_skip_invalid_utf8() {
189+
TestManager::new()
190+
.mock_common_upload_endpoints(ServerBehavior::Modern, Default::default())
191+
.register_trycmd_test("sourcemaps/sourcemaps-with-invalid-utf8.trycmd")
192+
.with_default_token();
193+
}

0 commit comments

Comments
 (0)