From c57bafb78df393c147d12918085609b042d7611b Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 26 Sep 2022 09:54:11 +0200 Subject: [PATCH] Lowercase ENS name search query Since ENS names go through a UTS46 normalisation process case-folds labels before hashing them. So we shouldn't be ENS querying uppercase names. Signed-off-by: Sebastian Martinez --- src/resolver.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/resolver.ts b/src/resolver.ts index 4a4fe08f6..b6942ed2b 100644 --- a/src/resolver.ts +++ b/src/resolver.ts @@ -53,9 +53,14 @@ export async function resolve( results.projects.push(...projects); // ========= ENS Names ========= + const normalizedQuery = q.toLowerCase(); let profile: Profile | null; try { - profile = await Profile.get(q, ProfileType.Minimal, config); + profile = await Profile.get( + normalizedQuery, + ProfileType.Minimal, + config, + ); } catch (e) { profile = null; } @@ -71,7 +76,10 @@ export async function resolve( let profiles: Profile[]; try { profiles = await Profile.getMulti( - [`${q}.${config.registrar.domain}`, `${q}.eth`], + [ + `${normalizedQuery}.${config.registrar.domain}`, + `${normalizedQuery}.eth`, + ], config, ); } catch (e) {