From 417d1052dce36f6f30e4bd25776ac93e82bd81b1 Mon Sep 17 00:00:00 2001 From: Evilebot Tnawi Date: Mon, 26 Nov 2018 16:34:06 +0300 Subject: [PATCH] fix: correctly processing url with `?#hash` (#803) --- lib/loader.js | 2 +- test/urlTest.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/loader.js b/lib/loader.js index 6cee1ef5..629c9977 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -132,7 +132,7 @@ module.exports = function loader(content, map) { return `" + escape(require(${loaderUtils.stringifyRequest( this, urlRequest - )})) + "${url.substr(idx)}`; + )}) + "${url.substr(idx)}") + "`; } urlRequest = url; return `" + escape(require(${loaderUtils.stringifyRequest( diff --git a/test/urlTest.js b/test/urlTest.js index cd003c76..a75bc87d 100644 --- a/test/urlTest.js +++ b/test/urlTest.js @@ -99,11 +99,11 @@ describe('url', () => { ); test( 'font face', - "@font-face { src: url(regular.woff) format('woff'), url(~truetype/regular.ttf) format('truetype') }", + "@font-face { src: url(regular.woff) format('woff'), url(~truetype/regular.ttf) format('truetype'), url('Mark Simonson - Proxima Nova Alt Regular-webfont.eot?#iefix') format('embedded-opentype'), url('webfont.svg#svgFontName') format('svg'), url('webfont.woff2?foo=bar') format('woff2'); }", [ [ 1, - "@font-face { src: url({./regular.woff}) format('woff'), url({truetype/regular.ttf}) format('truetype') }", + "@font-face { src: url({./regular.woff}) format('woff'), url({truetype/regular.ttf}) format('truetype'), url(\"{./Mark Simonson - Proxima Nova Alt Regular-webfont.eot}?#iefix\") format('embedded-opentype'), url({./webfont.svg}#svgFontName) format('svg'), url({./webfont.woff2?foo=bar}) format('woff2'); }", '', ], ]