web-resource-inliner icon indicating copy to clipboard operation
web-resource-inliner copied to clipboard

Error cannot trigger when local file is not found

Open scandox opened this issue 6 years ago • 0 comments

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.

scandox avatar Sep 17 '18 14:09 scandox