Skip to content

Commit 64e019d

Browse files
fix: sync the absolutePath file URL prefix with schema-utils (#50)
The hoisted copy wanted exactly two slashes and a lower-case scheme, so a pre-compiled schema rejected `file:/abs` and `FILE:///abs` where the real keyword now takes both. The lookahead leaves the first slash to the path part, keeping a scheme with nothing absolute after it rejected.
1 parent 15e8f6b commit 64e019d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

precompile-schemas/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const postprocess = async (code) => {
131131
// Keep in sync with the `absolutePath` keyword of `schema-utils`, the
132132
// pre-compiled schema has to accept exactly what the real one accepts
133133
if (/absolutePathRegExp/.test(code))
134-
code = `const absolutePathRegExp = /^(?:file:\\/\\/)?(?:[A-Za-z]:[\\\\/]|\\\\\\\\|\\/)/;${code}`;
134+
code = `const absolutePathRegExp = /^(?:file:(?=\\/))?(?:[A-Za-z]:[\\\\/]|\\\\\\\\|\\/)/i;${code}`;
135135

136136
// remove unnecessary error code:
137137
code = code

0 commit comments

Comments
 (0)