From b401d97986a3681831703a7cc0f636927acf41fb Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 30 Jul 2014 10:22:41 -0700 Subject: [PATCH] remove special chars (including slashes) from pemfile names --- ca-store-generator.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ca-store-generator.js b/ca-store-generator.js index 15b601d..fad899e 100644 --- a/ca-store-generator.js +++ b/ca-store-generator.js @@ -138,10 +138,17 @@ function parseCertData(lines) { function dumpCerts(certs, filename, pemsDir) { certs.forEach(function (cert) { var pem = cert.quasiPEM() - , pemName = pem.name.toLowerCase().replace(/[\s\/]+/g, '-').replace(/-+/g, '-') + , pemName = pem.name.toLowerCase().replace(/[\\\s\/\(\)\.]+/g, '-').replace(/-+/g, '-') , pemsFile = path.join(pemsDir, pemName + '.pem') ; + /* + if (/[^\w\-]/.test(pemName)) { + //pemName = pemName.replace(/\\/g, '-'); + //pemName = pemName.replace(/[^\w-]/g, '-'); + console.log(pemName); + } + */ fs.writeFileSync(pemsFile, pem.value); });