fix: cc and bcc fields not set when sending mail due to incorrect condition in SendMail (v1.15.x)#1143
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the SendMail function where cc and bcc fields were not being set correctly due to incorrect condition checks. The issue was that the code was checking the length of the email struct's fields (e.Bcc and e.Cc) instead of the input parameters.
- Fixed condition checks to use input parameters instead of uninitialized struct fields
- Ensures
ccandbccfields are properly set when provided
|
|
||
| e.To = to | ||
| if len(e.Bcc) > 0 { | ||
| if len(bcc) > 0 { |
There was a problem hiding this comment.
The fix correctly addresses the logic error. Previously, e.Bcc would always be empty at this point since it hasn't been assigned yet, so the condition len(e.Bcc) > 0 would never be true, preventing the bcc parameter from being assigned.
| e.Bcc = bcc | ||
| } | ||
| if len(e.Cc) > 0 { | ||
| if len(cc) > 0 { |
There was a problem hiding this comment.
The fix correctly addresses the logic error. Previously, e.Cc would always be empty at this point since it hasn't been assigned yet, so the condition len(e.Cc) > 0 would never be true, preventing the cc parameter from being assigned.
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.
| Benchmark suite | Current: 0d891dc | Previous: f9670e1 | Ratio |
|---|---|---|---|
Benchmark_DecryptString |
6703 ns/op 2040 B/op 17 allocs/op |
2123 ns/op 2032 B/op 16 allocs/op |
3.16 |
Benchmark_DecryptString - ns/op |
6703 ns/op |
2123 ns/op |
3.16 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v1.15.x #1143 +/- ##
==========================================
Coverage ? 68.77%
==========================================
Files ? 219
Lines ? 18873
Branches ? 0
==========================================
Hits ? 12979
Misses ? 5233
Partials ? 661 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📑 Description
Closes https://github.com/goravel/goravel/issues/
✅ Checks