Skip to content

Commit

Permalink
feat: support non-ascii characters for ENS
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechsimetka committed May 30, 2022
1 parent 8e22ebb commit 0c4a523
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 31 deletions.
64 changes: 36 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"url": "https://github.com/ethersphere/bee-dashboard.git"
},
"dependencies": {
"@ethersphere/bee-js": "^3.3.4",
"@ethersphere/bee-js": "^4.1.1",
"@ethersphere/manifest-js": "1.1.0",
"@ethersphere/swarm-cid": "^0.1.0",
"@material-ui/core": "4.12.3",
Expand Down
4 changes: 2 additions & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ export function extractSwarmCid(s: string): string | undefined {
}
}

// Matches any number of subdomains ending with .eth
// Matches any number of subdomain with .eth
// e.g. this.is.just-a-test.eth
export const regexpEns = /((?:(?!-)[a-z0-9-]{1,63}(?<!-)\.)+eth)(?:$|[/?:#].*)/i
export const regexpEns = /((?:(?:[^-./?:\s][^./?:\s]{0,61}[^-./?:\s]|[^-./?:\s]{1,2})\.)+eth)(?:$|[/?:#].*)/i

export function extractEns(value: string): string | undefined {
const matches = value.match(regexpEns)
Expand Down

0 comments on commit 0c4a523

Please sign in to comment.