From 0c2dffca89afe519c33c15c04b3a4acaae38d5fd Mon Sep 17 00:00:00 2001 From: Mourad Date: Wed, 24 Feb 2016 23:01:32 +0100 Subject: [PATCH] fix(karma): Escape quotes for file names. This fixes issue #1876. --- lib/middleware/karma.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/middleware/karma.js b/lib/middleware/karma.js index a36a53617..f1b632a31 100644 --- a/lib/middleware/karma.js +++ b/lib/middleware/karma.js @@ -151,6 +151,8 @@ var createKarmaMiddleware = function (filesPromise, serveStaticFile, serveFile, var mappings = files.served.map(function (file) { // Windows paths contain backslashes and generate bad IDs if not escaped var filePath = filePathToUrlPath(file.path, basePath, urlRoot).replace(/\\/g, '\\\\') + // Escape any quotes that might be in the filename + filePath = filePath.replace(/'/g, '\\\'').replace(/"/g, '\\\"') return util.format(" '%s': '%s'", filePath, file.sha) })