Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe double-quote handling in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/imio/helpers/emailer.py`:
- Around line 252-257: The current normalization in the email formatter removes
every double-quote via name_part.replace('"', ''), which corrupts
intended/escaped quotes; instead only collapse doubled quotes into a single
quote. Update the logic in the block handling parts = re.match(...) so that
clean_name collapses double-quotes (e.g. replace occurrences of '""' with '"' or
use a regex to substitute r'""' -> '"') rather than removing all '"' characters,
then continue to reformat eml as before with u'"{}" <{}>'. Ensure this change is
applied where name_part and addr_part are extracted so escaped single quotes are
preserved.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a1d0c96d-fa44-4dce-965d-91e4a93b8841
📒 Files selected for processing (1)
src/imio/helpers/emailer.py
| # '"\\"' ends with '""' and must be corrected. We choose to un-double the doublequotes | ||
| parts = re.match(r'^["\s]*(.*?)["\s]*<(.*)>', eml) | ||
| if parts: | ||
| name_part, addr_part = parts.groups() | ||
| clean_name = name_part.replace('"', '') | ||
| eml = u'"{}" <{}>'.format(clean_name, addr_part) |
There was a problem hiding this comment.
Quote normalization is over-aggressive and can corrupt valid real names.
On Line 256, name_part.replace('"', '') strips all quotes, including intentional/escaped ones. That conflicts with existing expected behavior (see src/imio/helpers/tests/test_email.py:163-193, escaped-quote case). Please normalize only doubled quotes, not every quote character.
Proposed targeted fix
- parts = re.match(r'^["\s]*(.*?)["\s]*<(.*)>', eml)
+ parts = re.match(r'^\s*(.*?)\s*<([^<>]+)>\s*$', eml)
if parts:
name_part, addr_part = parts.groups()
- clean_name = name_part.replace('"', '')
- eml = u'"{}" <{}>'.format(clean_name, addr_part)
+ # Only undouble raw double-quotes; preserve intentional/escaped quotes.
+ clean_name = re.sub(r'(?<!\\)""', '"', name_part)
+ eml = u'{} <{}>'.format(clean_name.strip(), addr_part)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/imio/helpers/emailer.py` around lines 252 - 257, The current
normalization in the email formatter removes every double-quote via
name_part.replace('"', ''), which corrupts intended/escaped quotes; instead only
collapse doubled quotes into a single quote. Update the logic in the block
handling parts = re.match(...) so that clean_name collapses double-quotes (e.g.
replace occurrences of '""' with '"' or use a regex to substitute r'""' -> '"')
rather than removing all '"' characters, then continue to reformat eml as before
with u'"{}" <{}>'. Ensure this change is applied where name_part and addr_part
are extracted so escaped single quotes are preserved.
Summary by CodeRabbit