* Drop dependency on temp module * Download files to music-folder/.tmp/ before moving them. * Don't watch folders that start with a '.' * Don't allow generated paths to start with a '.' Fixes import file race condition. Prevents needless file copy operation when importing in situations where the music directory is in a different device than /tmp.
11 lines
265 B
JavaScript
11 lines
265 B
JavaScript
module.exports = safePath;
|
|
|
|
var MAX_LEN = 100;
|
|
|
|
function safePath(string) {
|
|
string = string.replace(/[<>:"\/\\|?*%]/g, "_");
|
|
string = string.substring(0, MAX_LEN);
|
|
string = string.replace(/\.$/, "_");
|
|
string = string.replace(/^\./, "_");
|
|
return string;
|
|
}
|