Skip to content

Commit 4a04126

Browse files
authored
fix(js): Prefer "debug_id" (#878)
#877 overzealously switched the default key from debug_id to debugId. While both should be supported, we should default to the current debug_id for now and make the switch in a considered manner.
1 parent 573eb09 commit 4a04126

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
**Fixes**
6+
- js: Prefer `"debug_id"` for sourcemap debug IDs. ([#878](https://github.com/getsentry/symbolic/pull/878)).
7+
38
## 12.12.2
49

510
**Fixes**

symbolic-debuginfo/src/js.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ pub fn discover_sourcemaps_location(contents: &str) -> Option<&str> {
3131
/// Quickly reads the embedded `debug_id` key from a source map.
3232
///
3333
/// Both `debugId` and `debug_id` are supported as field names. If both
34-
/// are set, the former takes precedence.
34+
/// are set, the latter takes precedence.
3535
pub fn discover_sourcemap_embedded_debug_id(contents: &str) -> Option<DebugId> {
3636
// Deserialize from `"debugId"` or `"debug_id"`,
37-
// preferring the former.
37+
// preferring the latter.
3838
#[derive(Deserialize)]
3939
struct DebugIdInSourceMap {
4040
#[serde(rename = "debugId")]
@@ -45,7 +45,7 @@ pub fn discover_sourcemap_embedded_debug_id(contents: &str) -> Option<DebugId> {
4545

4646
serde_json::from_str(contents)
4747
.ok()
48-
.and_then(|x: DebugIdInSourceMap| x.debug_id_new.or(x.debug_id_old))
48+
.and_then(|x: DebugIdInSourceMap| x.debug_id_old.or(x.debug_id_new))
4949
}
5050

5151
/// Parses a `debugId` comment in a file to discover a sourcemap's debug ID.
@@ -103,8 +103,8 @@ mod tests {
103103
"sources":["coolstuff.js"],
104104
"names":["x","alert"],
105105
"mappings":"AAAA,GAAIA,GAAI,EACR,IAAIA,GAAK,EAAG,CACVC,MAAM",
106-
"debugId":"00000000-0000-0000-0000-000000000000",
107-
"debug_id":"11111111-1111-1111-1111-111111111111"
106+
"debug_id":"00000000-0000-0000-0000-000000000000",
107+
"debugId":"11111111-1111-1111-1111-111111111111"
108108
}"#;
109109

110110
assert_eq!(

0 commit comments

Comments
 (0)