Skip to content

Commit

Permalink
Fixed handling of unknown door types
Browse files Browse the repository at this point in the history
  • Loading branch information
cognitivegears committed Nov 5, 2023
1 parent 9bb8277 commit 04392e3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
5 changes: 5 additions & 0 deletions core/abracadabra.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
],
Expand Down
16 changes: 9 additions & 7 deletions core/dropfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions dropfile_formats/CALLINFO.BBS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,6 +31,6 @@ REMOTE
38400
FALSE
Normal Connection
{DT} {CT}
{getCurrentDateMMDDYY} {CT}
{ND}
0

0 comments on commit 04392e3

Please sign in to comment.