This check performs this boolean (validUrl.isUri(val) && val.indexOf('file:') === '0'). However, the value of val.indexOf('file:') is a number not a string. When using exactly equals (===) no type conversion will occur. This will make the test fail and incorrectly mark this as not a file.
1) What version of the module is the issue happening on? Does the issue happen on latest version?
0.10.0
2) What platform and Node.js version? (For example Node.js 0.12 on Mac OS X)
10.15.3
3) Sample source code or steps to reproduce
References that use the
file:
prefix are not correctly marked as files. This is due to the boolean check at https://github.com/bojand/json-schema-deref-sync/blob/10b1b3b94ffa27d8312537bbf540a59ac7aeaf27/lib/utils.js#L36.This check performs this boolean
(validUrl.isUri(val) && val.indexOf('file:') === '0')
. However, the value ofval.indexOf('file:')
is a number not a string. When using exactly equals (===
) no type conversion will occur. This will make the test fail and incorrectly mark this as not a file.Example:
file:path/file.json#/parent/child