From 2ade70f0377771080ea8a950d980a30b2e21da25 Mon Sep 17 00:00:00 2001 From: Andrew Sutton Date: Wed, 21 Oct 2015 13:56:07 -0400 Subject: [PATCH] fix: escape filesystem characters in browser name --- index.js | 3 ++- package.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 86b74fe..ebe7c97 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ var os = require('os') var path = require('path') var fs = require('fs') var builder = require('xmlbuilder') +var sanitizeFilename = require('sanitize-filename') var JUnitReporter = function (baseReporterDecorator, config, logger, helper, formatError) { var log = logger.create('reporter.junit') @@ -48,7 +49,7 @@ var JUnitReporter = function (baseReporterDecorator, config, logger, helper, for } var writeXmlForBrowser = function (browser) { - var safeBrowserName = browser.name.replace(/ /g, '_') + var safeBrowserName = sanitizeFilename(browser.name, { replacement: '_' }).replace(/ /g, '_') var newOutputFile if (outputFile != null) { var dir = useBrowserName ? path.join(outputDir, safeBrowserName) diff --git a/package.json b/package.json index 385a791..a9db221 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ ], "author": "Vojta Jina ", "dependencies": { + "sanitize-filename": "1.4.5", "xmlbuilder": "3.1.0" }, "peerDependencies": {