remove special chars (including slashes) from pemfile names

This commit is contained in:
AJ ONeal 2014-07-30 10:22:41 -07:00
parent d9cbaa7b8e
commit b401d97986
1 changed files with 8 additions and 1 deletions

View File

@ -138,10 +138,17 @@ function parseCertData(lines) {
function dumpCerts(certs, filename, pemsDir) { function dumpCerts(certs, filename, pemsDir) {
certs.forEach(function (cert) { certs.forEach(function (cert) {
var pem = cert.quasiPEM() 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') , 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); fs.writeFileSync(pemsFile, pem.value);
}); });