Skip to content

Commit e8b42e0

Browse files
Timerthongdong7
authored andcommitted
Unmapper Windows compatibility (facebook#3079)
* Switch to unix path separators before normalizing path for Windows compatibility * Add comment for posterity * Revert "Add comment for posterity" This reverts commit 742bace. * Strictly add comment
1 parent 4661202 commit e8b42e0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/react-error-overlay/src/utils/unmapper.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,19 @@ async function unmap(
5656
}
5757
let { fileName } = frame;
5858
if (fileName) {
59-
fileName = path.normalize(fileName);
59+
// The web version of this module only provides POSIX support, so Windows
60+
// paths like C:\foo\\baz\..\\bar\ cannot be normalized.
61+
// A simple solution to this is to replace all `\` with `/`, then
62+
// normalize afterwards.
63+
fileName = path.normalize(fileName.replace(/[\\]+/g, '/'));
6064
}
6165
if (fileName == null) {
6266
return frame;
6367
}
6468
const fN: string = fileName;
6569
const source = map
6670
.getSources()
71+
// Prepare path for normalization; see comment above for reasoning.
6772
.map(s => s.replace(/[\\]+/g, '/'))
6873
.filter(p => {
6974
p = path.normalize(p);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy