Skip to content

Commit

Permalink
fix: rewrite content template path in nested directory (#2965)
Browse files Browse the repository at this point in the history
* fix: rewrite content template path in nested directory

* chore: remove unnecessary clean
  • Loading branch information
sweatybridge authored Dec 11, 2024
1 parent 06044ce commit baa2c23
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,15 @@ func (c *config) Load(path string, fsys fs.FS) error {
if version, err := fs.ReadFile(fsys, builder.PgmetaVersionPath); err == nil && len(version) > 0 {
c.Studio.PgmetaImage = replaceImageTag(pgmetaImage, string(version))
}
// Update content paths
for name, tmpl := range c.Auth.Email.Template {
// FIXME: only email template is relative to repo directory
cwd := filepath.Dir(builder.SupabaseDirPath)
if len(tmpl.ContentPath) > 0 && !filepath.IsAbs(tmpl.ContentPath) {
tmpl.ContentPath = filepath.Join(cwd, tmpl.ContentPath)
}
c.Auth.Email.Template[name] = tmpl
}
// Update fallback configs
for name, bucket := range c.Storage.Buckets {
if bucket.FileSizeLimit == 0 {
Expand Down Expand Up @@ -834,7 +843,7 @@ func (e *email) validate(fsys fs.FS) (err error) {
}
continue
}
if content, err := fs.ReadFile(fsys, filepath.Clean(tmpl.ContentPath)); err != nil {
if content, err := fs.ReadFile(fsys, tmpl.ContentPath); err != nil {
return errors.Errorf("Invalid config for auth.email.%s.content_path: %w", name, err)
} else {
tmpl.Content = cast.Ptr(string(content))
Expand Down

0 comments on commit baa2c23

Please sign in to comment.