From ad0a13fa02caf6223957194f1d2513ea7b553710 Mon Sep 17 00:00:00 2001 From: megatronCGN Date: Thu, 11 Jan 2018 11:23:11 +0100 Subject: [PATCH 1/2] Avoid stripping single and double quotes from data:image urls --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index a7076d7..1a2b852 100644 --- a/index.js +++ b/index.js @@ -23,6 +23,9 @@ var func = require('rework-plugin-function'); module.exports = function(fn) { return func({ url: function(path){ + if (path.indexOf('data:image') == 0) { + return 'url("' + path + '")'; + } path = path.split('"').join(''); path = path.split('\'').join(''); return 'url("' + fn.call(this, path.trim()) + '")'; From 50a5832a3add40fff485ad5a68bdcbe10f7a91d0 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Fri, 3 Jan 2020 12:56:29 +0100 Subject: [PATCH 2/2] Use strict equality check --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 1a2b852..e615ff5 100644 --- a/index.js +++ b/index.js @@ -23,7 +23,7 @@ var func = require('rework-plugin-function'); module.exports = function(fn) { return func({ url: function(path){ - if (path.indexOf('data:image') == 0) { + if (path.indexOf('data:image') === 0) { return 'url("' + path + '")'; } path = path.split('"').join('');