matcha
matcha copied to clipboard
BUG: Missing validation for empty IMAP/SMTP server config
Describe the bug
In config/config.go lines 86 and 115, empty IMAPServer and SMTPServer values return empty strings without validation:
func (a *Account) GetIMAPServer() string {
if a.IMAPServer == "" {
return "" // No error
}
return a.IMAPServer
}
Error caught later in fetcher/fetcher.go:236, but better to validate early at config load.
To reproduce
- Create config with empty
imap_serverfield - Start matcha
- Connection fails with unclear error downstream
- Should fail fast with clear validation error
Expected behavior
Validate config on load:
func (c *Config) Validate() error {
for _, acc := range c.Accounts {
if acc.IMAPServer == "" {
return fmt.Errorf("account %q: imap_server is required", acc.Email)
}
if acc.SMTPServer == "" {
return fmt.Errorf("account %q: smtp_server is required", acc.Email)
}
}
return nil
}
Screenshots
N/A
Additional context
- File:
config/config.go - Lines: 86, 115
- Severity: Low-Medium - poor error UX
- Fix complexity: Easy - add validation function
This has had no activity for 30 days. It will be closed in 14 days unless updated. Comment or remove the stale label to keep it open.
Closing due to inactivity. Reopen if still relevant.