Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for mail to invalid FTN address #505

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/fse.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ exports.FullScreenEditorModule =
var newFocusViewId;
if (errMsgView) {
if (err) {
errMsgView.clearText();
errMsgView.setText(err.message);

if (MciViewIds.header.subject === err.view.getId()) {
Expand Down
26 changes: 15 additions & 11 deletions core/system_view_validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,23 @@ function validateUserNameOrRealNameExists(data, cb) {
}

function validateGeneralMailAddressedTo(data, cb) {
//
// Allow any supported addressing:
// - Local username or real name
// - Supported remote flavors such as FTN, email, ...
//
// :TODO: remove hard-coded FTN check here. We need a decent way to register global supported flavors with modules.
const addressedToInfo = getAddressedToInfo(data);
try {
//
// Allow any supported addressing:
// - Local username or real name
// - Supported remote flavors such as FTN, email, ...
//
// :TODO: remove hard-coded FTN check here. We need a decent way to register global supported flavors with modules.
const addressedToInfo = getAddressedToInfo(data);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we're just catching a undefined/null. This can probably be switched to a less heavy if (!addressedToInfo) { }.

For the error itself, please use Errors.Invalid, e.g. Errors.Invalid('Invalid address')


if (Message.AddressFlavor.FTN === addressedToInfo.flavor) {
return cb(null);
}

if (Message.AddressFlavor.FTN === addressedToInfo.flavor) {
return cb(null);
return validateUserNameOrRealNameExists(data, cb);
} catch (e) {
return cb(new Error('Invalid address'));
}

return validateUserNameOrRealNameExists(data, cb);
}

function validateEmailAvail(data, cb) {
Expand Down