Skip to content

Commit

Permalink
esm: identify parent importing a url with invalid host
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobJingleheimer committed Sep 21, 2023
1 parent b64f620 commit 331c950
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/internal/modules/esm/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,15 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
fileURLToPath(base));
}

const path = fileURLToPath(resolved);
let path;
try {
path = fileURLToPath(resolved);
} catch (err) {
const { setOwnProperty } = require('internal/util');
setOwnProperty(err, 'input', `${resolved}`);
setOwnProperty(err, 'module', `${base}`);
throw err;
}

const stats = internalModuleStat(toNamespacedPath(StringPrototypeEndsWith(path, '/') ?
StringPrototypeSlice(path, -1) : path));
Expand Down

0 comments on commit 331c950

Please sign in to comment.