Skip to content

Commit

Permalink
ignore cid: srcs
Browse files Browse the repository at this point in the history
  • Loading branch information
jrit committed Nov 17, 2016
1 parent 62e9a0c commit eb84e0b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ util.getTextReplacement = function( src, settings, callback )

util.getFileReplacement = function( src, settings, callback )
{
if( !src )
if( !src || util.srcIsCid( src ) )
{
callback( null, "" );
callback( null );
}
else if( util.isRemotePath( settings.relativeTo ) )
{
Expand All @@ -186,6 +186,11 @@ util.getFileReplacement = function( src, settings, callback )
}
};

util.srcIsCid = function( src )
{
return src.match( /^cid:/ );
};

util.handleReplaceErr = function( err, src, strict, callback )
{
if( strict )
Expand Down
4 changes: 3 additions & 1 deletion test/cases/img.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
<body>
<img src="assets/icon.png" />
<img src="/assets/icon.png" />
<img src="cid:whatever" />
<img src="" alt="nothing" />
</body>
</html>
</html>
4 changes: 3 additions & 1 deletion test/cases/img_out.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
<body>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAHklEQVQoz2NgAIP/YMBAPBjVMNAa/pMISNcwEoMVAH0ls03D44ABAAAAAElFTkSuQmCC" />
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAHklEQVQoz2NgAIP/YMBAPBjVMNAa/pMISNcwEoMVAH0ls03D44ABAAAAAElFTkSuQmCC" />
<img src="cid:whatever" />
<img src="" alt="nothing" />
</body>
</html>
</html>

0 comments on commit eb84e0b

Please sign in to comment.