Fixed handling of unknown door types

This commit is contained in:
Nathan Byrd 2023-11-05 00:21:49 +00:00
parent 9bb8277583
commit 04392e387d
3 changed files with 18 additions and 11 deletions

View File

@ -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);
},
],

View File

@ -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;
}

View File

@ -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