2015-12-04 00:28:18 +08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var path = require('path');
|
|
|
|
|
2019-12-27 00:46:27 +08:00
|
|
|
module.exports = function sanitizeFilename (filename) {
|
2019-12-24 01:19:08 +08:00
|
|
|
filename = path.basename(filename, path.extname(filename));
|
2019-12-27 00:46:27 +08:00
|
|
|
filename = filename.replace(/[;()\[\]<>'"\s]/g, '_'); // eslint-disable-line no-useless-escape
|
2019-12-24 01:19:08 +08:00
|
|
|
return filename;
|
2015-12-04 00:28:18 +08:00
|
|
|
};
|