[18.0][FIX] fetchmail_attach_from_folder: case-insensitive email matching#3610
[18.0][FIX] fetchmail_attach_from_folder: case-insensitive email matching#3610fsmw wants to merge 1 commit into
Conversation
|
Hi @NL66278, |
|
@fsmw I think the bug is valid and the problem real. However replacing an equal comparison |
Emails with uppercase letters were not matching partner records
because the search used "=" which is case-sensitive in PostgreSQL.
Changes:
- Use Odoo's email_normalize() on incoming addresses for consistent,
normalized matching (strips display names, lowercases).
- Keep "=ilike" operator, but now search values are normalized so
there are no wildcards — it functions as a case-insensitive "=".
- Added test coverage for partner stored as uppercase and display-name
headers ("Name <email@domain>").
Fixes OCA#3402
8507d1e to
ee2f961
Compare
|
Hi @NL66278, thanks for the review and the valid concern. Your suggestion has been incorporated:
Let me know if anything else is needed. |
| # Normalize using email_normalize for consistent matching. | ||
| # This strips display names, lowercases the address, and handles | ||
| # edge cases (e.g. "<user@domain.com>" or "User <user@domain.com>"). | ||
| return [email_normalize(addr) or addr.lower() for addr in mailaddresses] |
There was a problem hiding this comment.
Is the or addr.lower() not superfluous here?
Bug
Closes #3402
Emails containing uppercase letters were not linked to partner records because the match algorithm lowercased the incoming email addresses but then searched with (case-sensitive exact match). If the partner stored the email as mixed-case (e.g. Name.SURNAME@Domain.com), the match failed.
Fix
Use Odoo's operator instead of . This matches Odoo's own approach in core ( line 965) and performs a case-insensitive exact match via PostgreSQL .
Changes
Compatibility