From c0a309b05fcc495111256c997196f1656b57293c Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Sun, 1 Nov 2026 00:53:48 -0500 Subject: [PATCH 1/2] =?UTF-8?q?fix(id):=20petname=20skeleton=20=E2=80=94?= =?UTF-8?q?=20capital-I=20class=20(i->l)=20and=208->b,=20labels()=20skelet?= =?UTF-8?q?on=20collisions=20(#2069)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgs/id/src/petname.rs | 80 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/pkgs/id/src/petname.rs b/pkgs/id/src/petname.rs index e5f620454f..cf08d614fe 100644 --- a/pkgs/id/src/petname.rs +++ b/pkgs/id/src/petname.rs @@ -303,16 +303,19 @@ pub fn fold(name: &str) -> String { } /// The name with look-alike characters mapped to one form, so `PayPa1` and -/// `PayPal` compare equal. +/// `PayPal` compare equal. The fold lowercases first, so capital `I` lands +/// in the `i` class and maps to `l` with `1` and `|` (#2069); `8` maps to +/// `b`, symmetric with the other mapped digits. #[must_use] pub fn skeleton(name: &str) -> String { let mapped: String = fold(name) .chars() .map(|c| match c { '0' => 'o', - '1' | '|' => 'l', + '1' | '|' | 'i' => 'l', '3' => 'e', '5' | '$' => 's', + '8' => 'b', '@' => 'a', other => other, }) @@ -373,18 +376,19 @@ pub fn fingerprint(id: &str) -> String { } /// How each contact is shown: its petname if it has one, otherwise its -/// alleged name marked unverified. Petnames that collide after folding get a -/// fingerprint on both contacts. +/// alleged name marked unverified. Petnames that collide by skeleton +/// (look-alike) comparison get a fingerprint on both contacts, so a legacy +/// stored name that `set` would now refuse still renders distinctly (#2069). #[must_use] pub fn labels(contacts: &[Contact<'_>]) -> Vec