From 31d8ac609404e4cdc5e2a3160d1cc56be26d5906 Mon Sep 17 00:00:00 2001 From: Ryan Miller Date: Sat, 8 Feb 2025 15:44:06 +1100 Subject: [PATCH] fix: add punycode support for emoji ons --- package.json | 1 + ts/components/leftpane/overlay/OverlayMessage.tsx | 3 ++- yarn.lock | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8448927cd..690e14d85 100644 --- a/package.json +++ b/package.json @@ -103,6 +103,7 @@ "os-locale": "5.0.0", "p-retry": "^4.2.0", "protobufjs": "^7.2.4", + "punycode": "^2.3.1", "rc-slider": "^10.6.2", "react": "18.3.1", "react-contexify": "^6.0.0", diff --git a/ts/components/leftpane/overlay/OverlayMessage.tsx b/ts/components/leftpane/overlay/OverlayMessage.tsx index f000c060f..80f4cdd3b 100644 --- a/ts/components/leftpane/overlay/OverlayMessage.tsx +++ b/ts/components/leftpane/overlay/OverlayMessage.tsx @@ -5,6 +5,7 @@ import styled from 'styled-components'; import { motion } from 'framer-motion'; import { isEmpty } from 'lodash'; import { useDispatch } from 'react-redux'; +import { toASCII } from 'punycode'; import { ConvoHub } from '../../../session/conversations'; @@ -104,7 +105,7 @@ export const OverlayMessage = () => { return; } - const pubkeyOrOnsTrimmed = pubkeyOrOns.trim(); + const pubkeyOrOnsTrimmed = toASCII(pubkeyOrOns.trim()); const validationError = PubKey.validateWithErrorNoBlinding(pubkeyOrOnsTrimmed); if (!validationError) { diff --git a/yarn.lock b/yarn.lock index 73bc16ebd..0f877a0d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6150,7 +6150,7 @@ punycode.js@^2.3.1: resolved "https://registry.yarnpkg.com/punycode.js/-/punycode.js-2.3.1.tgz#6b53e56ad75588234e79f4affa90972c7dd8cdb7" integrity sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA== -punycode@^2.1.0, punycode@^2.1.1, punycode@^2.3.0: +punycode@^2.1.0, punycode@^2.1.1, punycode@^2.3.0, punycode@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==