Fix mailbox name for naked domains

Fixes #81
This commit is contained in:
Girish Ramakrishnan
2016-10-12 19:53:30 -07:00
parent 2be17eeb52
commit 1d8df65fbf
+4 -2
View File
@@ -504,7 +504,8 @@ function install(data, auditSource, callback) {
oauthProxy: oauthProxy
};
mailboxdb.add(location + '.app', appId, mailboxdb.TYPE_APP, function (error) {
var from = (location ? location : manifest.title.toLowerCase().replace(/[^a-zA-Z0-9]/g, '')) + '.app';
mailboxdb.add(from, appId, mailboxdb.TYPE_APP, function (error) {
if (error && error.reason === DatabaseError.ALREADY_EXISTS) return callback(new AppsError(AppsError.ALREADY_EXISTS, 'Mailbox already exists'));
if (error) return callback(new AppsError(AppsError.INTERNAL_ERROR, error));
@@ -829,7 +830,8 @@ function clone(appId, data, auditSource, callback) {
lastBackupId: backupId
};
mailboxdb.add(location + '.app', newAppId, mailboxdb.TYPE_APP, function (error) {
var from = (location ? location : manifest.title.toLowerCase().replace(/[^a-zA-Z0-9]/g, '')) + '.app';
mailboxdb.add(from, newAppId, mailboxdb.TYPE_APP, function (error) {
if (error && error.reason === DatabaseError.ALREADY_EXISTS) return callback(new AppsError(AppsError.ALREADY_EXISTS, 'Mailbox already exists'));
if (error) return callback(new AppsError(AppsError.INTERNAL_ERROR, error));