diff options
Diffstat (limited to 'internal/email/util.go')
-rw-r--r-- | internal/email/util.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/email/util.go b/internal/email/util.go index 52290dbe4..c543db755 100644 --- a/internal/email/util.go +++ b/internal/email/util.go @@ -28,14 +28,16 @@ import ( ) func loadTemplates(templateBaseDir string) (*template.Template, error) { - cwd, err := os.Getwd() - if err != nil { - return nil, fmt.Errorf("error getting current working directory: %s", err) + if !filepath.IsAbs(templateBaseDir) { + cwd, err := os.Getwd() + if err != nil { + return nil, fmt.Errorf("error getting current working directory: %s", err) + } + templateBaseDir = filepath.Join(cwd, templateBaseDir) } // look for all templates that start with 'email_' - tmPath := filepath.Join(cwd, fmt.Sprintf("%semail_*", templateBaseDir)) - return template.ParseGlob(tmPath) + return template.ParseGlob(filepath.Join(templateBaseDir, "email_*")) } // https://datatracker.ietf.org/doc/html/rfc2822 |