High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
JavaScript campaigncampaign-managementemail-marketingemail-subscriptionlistmonkmailing-listnewsletternewsletter-managementnewsletter-softwareself-hostedsms-gatewaysmtptransactional-emails
fix: trim config before use (#1756)
Shivam Mishrad7b55cd1473e
diff --git a/cmd/settings.go b/cmd/settings.goindex 088120e3..e6e03e2d 100644--- a/cmd/settings.go+++ b/cmd/settings.go@@ -108,6 +108,10 @@ func handleUpdateSettings(c echo.Context) error {set.SMTP[i].UUID = uuid.Must(uuid.NewV4()).String()}+ // Ensure the HOST is trimmed of any whitespace.+ // This is a common mistake when copy-pasting SMTP settings.+ set.SMTP[i].Host = strings.TrimSpace(s.Host)+// If there's no password coming in from the frontend, copy the existing// password by matching the UUID.if s.Password == "" {@@ -134,6 +138,10 @@ func handleUpdateSettings(c echo.Context) error {set.BounceBoxes[i].UUID = uuid.Must(uuid.NewV4()).String()}+ // Ensure the HOST is trimmed of any whitespace.+ // This is a common mistake when copy-pasting SMTP settings.+ set.BounceBoxes[i].Host = strings.TrimSpace(s.Host)+if d, _ := time.ParseDuration(s.ScanInterval); d.Minutes() < 1 {return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("settings.bounces.invalidScanInterval"))}diff --git a/frontend/src/views/Settings.vue b/frontend/src/views/Settings.vueindex a5d27b90..bc412328 100644--- a/frontend/src/views/Settings.vue+++ b/frontend/src/views/Settings.vue@@ -112,6 +112,9 @@ export default Vue.extend({// SMTP boxes.let hasDummy = '';for (let i = 0; i < form.smtp.length; i += 1) {+ // trim the host before saving+ form.smtp[i].host = form.smtp[i].host?.trim();+// If it's the dummy UI password placeholder, ignore it.if (this.isDummy(form.smtp[i].password)) {form.smtp[i].password = '';@@ -128,6 +131,9 @@ export default Vue.extend({// Bounces boxes.for (let i = 0; i < form['bounce.mailboxes'].length; i += 1) {+ // trim the host before saving+ form['bounce.mailboxes'][i].host = form['bounce.mailboxes'][i].host?.trim();+// If it's the dummy UI password placeholder, ignore it.if (this.isDummy(form['bounce.mailboxes'][i].password)) {form['bounce.mailboxes'][i].password = '';