mirror of
https://github.com/remy/inliner.git
synced 2024-09-11 17:25:30 +03:00
fix: strip img query string from local files
When ? was left in url and parsing a local file. Fixes #72
This commit is contained in:
parent
5b7fc96bc3
commit
82fb14c11f
@ -7,7 +7,7 @@ var svgo = new SVGO();
|
||||
var Promise = require('es6-promise').Promise; // jshint ignore:line
|
||||
|
||||
function image(url) {
|
||||
url = url.replace(/#.*$/, '');
|
||||
url = url.replace(/\??#.*$/, '');
|
||||
var inliner = this;
|
||||
this.emit('progress', 'get image ' + url);
|
||||
return this.get(url, { encoding: 'binary' }).then(function then(res) {
|
||||
|
1
test/fixtures/image-url.result.html
vendored
Normal file
1
test/fixtures/image-url.result.html
vendored
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>inline image</title> </head> <body> <img src="data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACwAAAAAAQABAAACAkQBADs="> </body> </html>
|
10
test/fixtures/image-url.src.html
vendored
Normal file
10
test/fixtures/image-url.src.html
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>inline image</title>
|
||||
</head>
|
||||
<body>
|
||||
<img src="1x1.gif?#iefix">
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user