diff --git a/app.js b/app.js index 7d238f1..098e745 100644 --- a/app.js +++ b/app.js @@ -212,13 +212,17 @@ console.log(self.storages); var attachments = storageData.attachments; for(var i in attachments) if(attachments.hasOwnProperty(i)) { var thisItem = attachments[i]; - var settings = thisItem.settings; - if (thisItem.settings && thisItem.settings.port) { - thisItem.settings.port = Number(thisItem.settings.port); - } else { - thisItem.settings.port = 443; - if (type == "couchdb") thisItem.settings.port = 5984; + var settings = {}; + if (thisItem.settings) { + settings = _.omitBy(thisItem.settings, _.isEmpty); //filter out empty values + if (settings.port) { + settings.port = Number(settings.port); + } else { + settings.port = 443; + if (type == "couchdb") settings.port = 5984; + } } + thisItem.settings = settings; attachments[i] = thisItem; }; storageData.attachments = attachments;