mirror of
https://github.com/remy/inliner.git
synced 2024-09-11 17:25:30 +03:00
fix: resolving already resolved HTTP links in file
Also includes tests
This commit is contained in:
parent
747836d3e0
commit
cbcd398182
@ -275,11 +275,16 @@ function resolve(from, to) {
|
||||
from = this.url;
|
||||
}
|
||||
|
||||
// don't resolve data urls
|
||||
// don't resolve data urls (already inlined)
|
||||
if (to.indexOf('data:') === 0) {
|
||||
return to;
|
||||
}
|
||||
|
||||
// don't resolve http(s) urls (no need to resolve)
|
||||
if (to.indexOf('http:') === 0 || to.indexOf('https:') === 0) {
|
||||
return to;
|
||||
}
|
||||
|
||||
if (!this.isFile || from.indexOf('http') === 0) {
|
||||
return require('url').resolve(from, to);
|
||||
} else {
|
||||
|
1
test/fixtures/image-ext.result.html
vendored
Normal file
1
test/fixtures/image-ext.result.html
vendored
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>External image (or local but already resolved source URL)</title> </head> <body> <img src="data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACwAAAAAAQABAAACAkQBADs="> </body> </html>
|
10
test/fixtures/image-ext.src.html
vendored
Normal file
10
test/fixtures/image-ext.src.html
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>External image (or local but already resolved source URL)</title>
|
||||
</head>
|
||||
<body>
|
||||
<img src="http://localhost:54321/1x1.gif">
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user