CartoDB-SQL-API/lib/utils/filename-sanitizer.js

10 lines
247 B
JavaScript
Raw Normal View History

'use strict';
var path = require('path');
2019-12-24 01:19:08 +08:00
module.exports = function sanitize_filename (filename) {
filename = path.basename(filename, path.extname(filename));
filename = filename.replace(/[;()\[\]<>'"\s]/g, '_');
return filename;
};