Skip to content

Commit

Permalink
fix(spotlight): Remove Windows home directories from Sentry reports
Browse files Browse the repository at this point in the history
Fixes #639
  • Loading branch information
BYK committed Dec 17, 2024
1 parent a9c3c5a commit 27c4838
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-lizards-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@spotlightjs/spotlight': patch
---

Remove Windows home directories from Sentry reports
3 changes: 2 additions & 1 deletion packages/spotlight/bin/instrument.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ init({
continue;
}

frame.filename = frame.filename?.replace(process.env.HOME, '~');
const homeDir = process.env.HOME || process.env.USERPROFILE;
frame.filename = frame.filename?.replace(homeDir, '~');
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/spotlight/bin/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ try {
sea = { isSea: () => false };
}

const homeDir = process.env.HOME || process.env.USERPROFILE;
setContext('CLI', {
sea: sea.isSea(),
// TODO: Be less naive with path obscuring
argv: process.argv.map(arg => arg.replace(process.env.HOME, '~')),
argv: process.argv.map(arg => arg.replace(homeDir, '~')),
});

const withTracing =
Expand Down

0 comments on commit 27c4838

Please sign in to comment.