web-resource-inliner
web-resource-inliner copied to clipboard
Error cannot trigger when local file is not found
In util.getFileReplacement
where the file is local, the callback cannot be reached if the file can't be found:
var result = ( new datauri( util.getInlineFilePath( src, settings.relativeTo ) ) ).content;
callback( result === undefined ? new Error( "Local file not found" ) : null, result );
The second line won't be reached if datauri
throws an error. As I understand it calling datauri constructor with just a file path means it will use encodeSync
and that throws. So this would have to be surrounded with a try...catch
?
Let me know if I'm missing a trick here.