CartoDB-SQL-API/app/utils/filename_sanitizer.js

10 lines
240 B
JavaScript
Raw Normal View History

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