0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 00:47:50 +01:00

fix(err): check for node_modules when guessing in_app (#26354)

This commit is contained in:
Oliver Browne 2024-11-22 13:21:01 +02:00 committed by GitHub
parent e80e6788b9
commit 51f44568b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -155,13 +155,19 @@ impl From<(&RawJSFrame, SourceLocation<'_>)> for Frame {
ScopeLookupResult::Unknown => None, ScopeLookupResult::Unknown => None,
}; };
let source = token.file().and_then(|f| f.name()).map(|s| s.to_string());
let in_app = source
.map(|s| !s.contains("node_modules"))
.unwrap_or(raw_frame.in_app);
let mut res = Self { let mut res = Self {
raw_id: String::new(), // We use placeholders here, as they're overriden at the RawFrame level raw_id: String::new(), // We use placeholders here, as they're overriden at the RawFrame level
mangled_name: raw_frame.fn_name.clone(), mangled_name: raw_frame.fn_name.clone(),
line: Some(token.line()), line: Some(token.line()),
column: Some(token.column()), column: Some(token.column()),
source: token.file().and_then(|f| f.name()).map(|s| s.to_string()), source: token.file().and_then(|f| f.name()).map(|s| s.to_string()),
in_app: raw_frame.in_app, in_app,
resolved_name, resolved_name,
lang: "javascript".to_string(), lang: "javascript".to_string(),
resolved: true, resolved: true,