FTN/BSN import/export now ignores case in filenames

This commit is contained in:
Bryan Ashby 2016-04-02 09:56:16 -06:00
parent fbf9bc49f9
commit a6d7d41601
1 changed files with 3 additions and 6 deletions

View File

@ -707,7 +707,7 @@ function FTNMessageScanTossModule() {
}, },
function moveFilesToOutgoing(exportedFileNames, callback) { function moveFilesToOutgoing(exportedFileNames, callback) {
async.each(exportedFileNames, (oldPath, nextFile) => { async.each(exportedFileNames, (oldPath, nextFile) => {
const ext = paths.extname(oldPath); const ext = paths.extname(oldPath).toLowerCase();
if('.pk_' === ext) { if('.pk_' === ext) {
// //
// For a given temporary .pk_ file, we need to move it to the outoing // For a given temporary .pk_ file, we need to move it to the outoing
@ -934,7 +934,7 @@ function FTNMessageScanTossModule() {
if(err) { if(err) {
return callback(err); return callback(err);
} }
callback(null, files.filter(f => '.pkt' === paths.extname(f))); callback(null, files.filter(f => '.pkt' === paths.extname(f).toLowerCase()));
}); });
}, },
function importPacketFiles(packetFiles, callback) { function importPacketFiles(packetFiles, callback) {
@ -988,11 +988,8 @@ function FTNMessageScanTossModule() {
}, },
function discoverBundles(callback) { function discoverBundles(callback) {
fs.readdir(importDir, (err, files) => { fs.readdir(importDir, (err, files) => {
// :TODO: Need to be explicit about files to attempt an extract, e.g. *.su?, *.mo?, ...
// :TODO: if we do much more of this, probably just use the glob module // :TODO: if we do much more of this, probably just use the glob module
//files = files.filter(f => '.pkt' !== paths.extname(f)); const bundleRegExp = /\.(su|mo|tu|we|th|fr|sa)[0-9a-z]/i;
const bundleRegExp = /\.(su|mo|tu|we|th|fr|sa)[0-9A-Za-z]/;
files = files.filter(f => { files = files.filter(f => {
const fext = paths.extname(f); const fext = paths.extname(f);
return bundleRegExp.test(fext); return bundleRegExp.test(fext);