Skip to content

Commit 9637978

Browse files
Strip colon-prefixed protocols from pasted addresses (#95)
1 parent 2408ca4 commit 9637978

File tree

1 file changed

+4
-4
lines changed
  • packages/nextjs/components/address-vision

1 file changed

+4
-4
lines changed

packages/nextjs/components/address-vision/Navbar.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ export const Navbar = () => {
5757
useEffect(() => {
5858
setEnsName("");
5959
let trimmedAddress = inputValue.trim();
60-
if (trimmedAddress.startsWith("eth:")) {
61-
trimmedAddress = trimmedAddress.slice(4);
62-
} else if (trimmedAddress.startsWith("oeth:")) {
63-
trimmedAddress = trimmedAddress.slice(5);
60+
// Remove any prefix with colon (e.g., "xyz:", "abc:", "eth:", etc.)
61+
const colonIndex = trimmedAddress.indexOf(":");
62+
if (colonIndex !== -1) {
63+
trimmedAddress = trimmedAddress.slice(colonIndex + 1);
6464
}
6565

6666
if (trimmedAddress.endsWith(".eth") || trimmedAddress.endsWith(".xyz") || trimmedAddress.endsWith(".com")) {

0 commit comments

Comments
 (0)