Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f8793f8

Browse filesBrowse files
legendecasaduh95
authored andcommitted
lib: fix source map url parse in dynamic imports
PR-URL: #61990 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 5b266f3 commit f8793f8
Copy full SHA for f8793f8

2 files changed

+61-2Lines changed: 61 additions & 2 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/source_map/source_map_cache.js‎

Copy file name to clipboardExpand all lines: lib/internal/source_map/source_map_cache.js
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,10 @@ function dataFromUrl(sourceURL, sourceMappingURL) {
247247
}
248248
}
249249

250-
const mapURL = new URL(sourceMappingURL, sourceURL).href;
250+
const mapURL = URLParse(sourceMappingURL, sourceURL);
251+
if (mapURL === null) {
252+
return null;
253+
}
251254
return sourceMapFromFile(mapURL);
252255
}
253256

@@ -276,7 +279,7 @@ function lineLengths(content) {
276279

277280
/**
278281
* Read source map from file.
279-
* @param {string} mapURL - file url of the source map
282+
* @param {URL} mapURL - file url of the source map
280283
* @returns {object} deserialized source map JSON object
281284
*/
282285
function sourceMapFromFile(mapURL) {
Collapse file

‎test/parallel/test-source-map-invalid-url.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-source-map-invalid-url.js
+56Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.