-
Notifications
You must be signed in to change notification settings - Fork 5k
email: fix unable to override templates in custom directory #7905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Introduce a `customDir` variable to store the custom template directory path, improving code readability and reducing redundancy in both `web.go` and `email.go`. This change ensures that the custom directory is consistently referenced throughout the configuration.
Thanks for the PR! Will review and test sometime soon. |
Thank you for your reply. Since English is not my native language, I used Chinese. If you need English or more help, please contact me. I will be happy to help you. |
Sorry for taking a while, looking at it now. And no worries I can speak Chinese, it's just for the sake of others watching/looking back to this PR, we only try to communicate in English (and I will update your PR title to reflect that upon merging). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7905 +/- ##
==========================================
- Coverage 15.28% 10.73% -4.55%
==========================================
Files 106 209 +103
Lines 13864 28867 +15003
==========================================
+ Hits 2119 3099 +980
- Misses 11465 25477 +14012
- Partials 280 291 +11 |
Co-authored-by: Joe Chen <jc@unknwon.io>
The 0.13.3 has been released that includes this patch. |
Describe the pull request
在
cusmtor/templates/mail
目录下放置tmpl
文件,无法被正确读取。Checklist
Test plan
FIleSystem在加载文件时,把
customer
+name
目录拼接,然后在该目录下寻找文件是否存在,不存在则使用系统默认模板。这个在
web
系统工作起来没有问题,但是在email
系统工作旧出现了问题。因为email中,传入的custorm
是custorm/templates/mail
,而FileSystem检索到的文件名是mail/xxx.tmpl
,两者相加得到custorm/templates/mail/mail/xxx.tmpl
,这将导致文件不存在。因为文件实际的路径是custorm/templates/mail/xxx.tmpl
。我修复了传入调用
NewTemplateFileSystem
时传入的curstomDir
参数,问题得到了解决。