Skip to content

Commit

Permalink
fix(js): Prefer debug_id
Browse files Browse the repository at this point in the history
  • Loading branch information
loewenheim committed Nov 26, 2024
1 parent 573eb09 commit c1cabb8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions symbolic-debuginfo/src/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ pub fn discover_sourcemaps_location(contents: &str) -> Option<&str> {
/// Quickly reads the embedded `debug_id` key from a source map.
///
/// Both `debugId` and `debug_id` are supported as field names. If both
/// are set, the former takes precedence.
/// are set, the latter takes precedence.
pub fn discover_sourcemap_embedded_debug_id(contents: &str) -> Option<DebugId> {
// Deserialize from `"debugId"` or `"debug_id"`,
// preferring the former.
// preferring the latter.
#[derive(Deserialize)]
struct DebugIdInSourceMap {
#[serde(rename = "debugId")]
Expand All @@ -45,7 +45,7 @@ pub fn discover_sourcemap_embedded_debug_id(contents: &str) -> Option<DebugId> {

serde_json::from_str(contents)
.ok()
.and_then(|x: DebugIdInSourceMap| x.debug_id_new.or(x.debug_id_old))
.and_then(|x: DebugIdInSourceMap| x.debug_id_old.or(x.debug_id_new))
}

/// Parses a `debugId` comment in a file to discover a sourcemap's debug ID.
Expand Down

0 comments on commit c1cabb8

Please sign in to comment.