Skip to content

Commit

Permalink
fix(replay): fix path separator substitution to replay all \ (#6932)
Browse files Browse the repository at this point in the history
Fixes [CodeQL #81](https://github.com/getsentry/sentry-javascript/security/code-scanning/81). The `.replace()` originally here only replaced the first occurrence of double-backslashes. Using a regex with a global flag option ensures all of the `\\`'s are replaced with `/`.
  • Loading branch information
mdtro authored Jan 25, 2023
1 parent 040ab0c commit a591f51
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/replay/metrics/src/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class JankTestScenario implements Scenario {
public async run(_: playwright.Browser, page: playwright.Page): Promise<void> {
let url = path.resolve(`./test-apps/jank/${this._indexFile}`);
assert(fs.existsSync(url));
url = `file:///${url.replace('\\', '/')}`;
url = `file:///${url.replace(/\\/g, '/')}`;
console.log('Navigating to ', url);
await page.goto(url, { waitUntil: 'load', timeout: 60000 });
await new Promise(resolve => setTimeout(resolve, 5000));
Expand Down

0 comments on commit a591f51

Please sign in to comment.