fix(channels): case-insensitive channel-ID match in find_by_name#609
fix(channels): case-insensitive channel-ID match in find_by_name#609slvnlrt wants to merge 1 commit into
Conversation
The channel-ID fallback lowercased the query but compared it against the raw (mixed-case) channel id with a case-sensitive contains(), so Teams conversation ids (which contain uppercase chars) never matched — breaking send_message_to_another_channel to Teams. Lowercase both sides.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Walkthrough
ChangesCase-insensitive channel ID matching
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| // already-lowercased query rather than the raw id). | ||
| if let Some(channel) = channels | ||
| .iter() | ||
| .find(|c| c.id.to_lowercase().contains(&name_lower)) |
There was a problem hiding this comment.
Minor perf note: to_lowercase() does full Unicode case-mapping + allocs. If channel IDs are expected to be ASCII, to_ascii_lowercase() is a bit cheaper here.
| .find(|c| c.id.to_lowercase().contains(&name_lower)) | |
| .find(|c| c.id.to_ascii_lowercase().contains(&name_lower)) |
ChannelStore::find_by_namelowercases the search query for its display-name matches, but the final channel-ID fallback compares that lowercased query against the raw channel id with a case-sensitivecontains:Channel ids that contain uppercase characters therefore never match the ID fallback when a target is passed by id — e.g. Microsoft Teams conversation ids like
teams:a:1-j_ftWddreoD7cw…(mixed case). This makessend_message_to_another_channelfail with "no channel found" for such channels even though they are listed as available. Numeric / lowercase-id platforms (Discord, Telegram, Slack) are unaffected, which is why it went unnoticed.Fix: lowercase both sides of the comparison (the query is already lowercased; lowercase the id too).
Surfaced while routing a cross-channel message to a Microsoft Teams DM on a live instance.
Note
Fixes case-insensitive matching for channel IDs in the
find_by_namemethod by lowercasing both sides of the ID comparison. This resolves an issue where mixed-case channel IDs (like Microsoft Teams conversation IDs) would fail to match despite being available, causing cross-channel message routing to fail with "no channel found".Written by Tembo for commit 04a3c777. This will update automatically on new commits.