Skip to content

Commit 1dd4baa

Browse files
RReverserkripken
authored andcommitted
Fix double-escaped paths on Windows (#9814)
On Windows, paths are using \, which is escaped to \\ by llvm-dwarfdump in its output. We need to unescape them before passing to source map encoder, as otherwise we end up with invalid paths and URLs that can't be resolved. This wasn't caught before, because assertPathsIdentical was performing its own unescaping before comparing paths, which is not what happens in real source map consumers. Fixes #9811.
1 parent 6b86c0b commit 1dd4baa

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tests/runner.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,8 @@ def assertNotExists(self, filename, msg=None):
808808

809809
# Tests that the given two paths are identical, modulo path delimiters. E.g. "C:/foo" is equal to "C:\foo".
810810
def assertPathsIdentical(self, path1, path2):
811-
path1 = path1.replace('\\', '/').replace('//', '/')
812-
path2 = path2.replace('\\', '/').replace('//', '/')
811+
path1 = path1.replace('\\', '/')
812+
path2 = path2.replace('\\', '/')
813813
return self.assertIdentical(path1, path2)
814814

815815
# Tests that the given two multiline text content are identical, modulo line

tools/wasm-sourcemap.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def resolve(self, name):
5858
if name in self.cache:
5959
return self.cache[name]
6060

61-
result = name
61+
result = name.replace('\\', '/').replace('//', '/')
6262
for p in self.prefixes:
6363
if name.startswith(p['prefix']):
6464
if p['replacement'] is None:

0 commit comments

Comments
 (0)