Skip to content

Commit e5eae7d

Browse files
fix: allow newlines in SMS OTP template (fixes supabase/supabase#6435)
1 parent 52cf3d9 commit e5eae7d

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

internal/conf/configuration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,7 @@ func populateGlobal(config *GlobalConfiguration) error {
11151115
if SMSTemplate == "" {
11161116
SMSTemplate = "Your code is {{ .Code }}"
11171117
}
1118+
SMSTemplate = strings.ReplaceAll(SMSTemplate, `\n`, "\n")
11181119
template, err := template.New("").Parse(SMSTemplate)
11191120
if err != nil {
11201121
return err

internal/conf/configuration_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ func TestGlobal(t *testing.T) {
241241
cfg := new(GlobalConfiguration)
242242
cfg.Sms.Provider = "invalid"
243243
cfg.Sms.Template = "{{{{{{{{{}}}}}}}}}"
244+
245+
244246

245247
err := populateGlobal(cfg)
246248
require.Error(t, err)

0 commit comments

Comments
 (0)