From 04392e387dbe70a3654df0ae843dce906665346c Mon Sep 17 00:00:00 2001 From: Nathan Byrd Date: Sun, 5 Nov 2023 00:21:49 +0000 Subject: [PATCH] Fixed handling of unknown door types --- core/abracadabra.js | 5 +++++ core/dropfile.js | 16 +++++++++------- dropfile_formats/CALLINFO.BBS | 8 ++++---- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/core/abracadabra.js b/core/abracadabra.js index 0d24d5f7..3b90a41d 100644 --- a/core/abracadabra.js +++ b/core/abracadabra.js @@ -158,6 +158,11 @@ exports.getModule = class AbracadabraModule extends MenuModule { fileType: self.config.dropFileType, }); + if(!(self.dropFile.isSupported())) { + // Return error so complete will log and return + return callback(Errors.AccessDenied('Dropfile format not supported')); + } + return self.dropFile.createFile(callback); }, ], diff --git a/core/dropfile.js b/core/dropfile.js index de57d841..e5267a9c 100644 --- a/core/dropfile.js +++ b/core/dropfile.js @@ -91,19 +91,21 @@ module.exports = class DropFile { return undefined; } const filePath = paths.join(this.dropFileFormatDirectory, fileName); - fs.access(filePath, fs.constants.R_OK, err => { - if (err) { - Log.info({filename: fileName}, 'Dropfile format not found.'); - return undefined; - } - }); + if(!fs.existsSync(filePath)) { + Log.info({filename: fileName}, 'Dropfile format not found or readable.'); + return undefined; + } // Return the handler to get the dropfile, because in the future we may have additional handlers return this.getDropfile; } getContents() { - const handler = this.getHandler().bind(this); + const handlerRef = this.getHandler(); + if(!handlerRef) { + return undefined; + } + const handler = handlerRef.bind(this); const contents = handler(); return contents; } diff --git a/dropfile_formats/CALLINFO.BBS b/dropfile_formats/CALLINFO.BBS index a7a6d7ac..d1d29a83 100644 --- a/dropfile_formats/CALLINFO.BBS +++ b/dropfile_formats/CALLINFO.BBS @@ -8,17 +8,17 @@ NOTPROVIDED {UI} 0 {CT} -{CT} {DT} +{CT} {getCurrentDateMMDDYY} {MC} {DN} 999 0 999999 555-555-5555 -{DT} {CT} +{getCurrentDateMMDDYY} {CT} NOVICE All -{DT} +{getCurrentDateMMDDYY} {UC} {SH} 0 @@ -31,6 +31,6 @@ REMOTE 38400 FALSE Normal Connection -{DT} {CT} +{getCurrentDateMMDDYY} {CT} {ND} 0 \ No newline at end of file