From dabdeb8a807ec9c20d05246e1c1704f9762edae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Mon, 11 Apr 2016 09:56:13 +0200 Subject: [PATCH] Fix #1195: fix external images and fix test for it --- lib/output/base.js | 4 ++++ test/page.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/output/base.js b/lib/output/base.js index 903323f16..a342c1e95 100644 --- a/lib/output/base.js +++ b/lib/output/base.js @@ -207,6 +207,10 @@ Output.prototype.onOutputSVG = function(page, svg) { // Output an image as a file // Normalize the relative link Output.prototype.onOutputImage = function(page, imgFile) { + if (location.isExternal(imgFile)) { + return imgFile; + } + imgFile = page.resolveLocal(imgFile); return page.relative(imgFile); }; diff --git a/test/page.js b/test/page.js index f961653a5..0fc59e7fc 100644 --- a/test/page.js +++ b/test/page.js @@ -289,7 +289,7 @@ describe('Page', function() { it('should keep external images path', function() { page.content.should.be.html({ - 'img[src="https:/upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"]': { + 'img[src="https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"]': { count: 1 } });