fix: search counterparts nip05 does not need to include '@'
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 50s

This commit is contained in:
Stixx 2024-12-06 20:58:20 +01:00
parent 0fd0f26fc7
commit 7b29d7055e

View File

@ -251,10 +251,15 @@ export const CreatePage = () => {
} else {
// Otherwize if search already provided some results, user must manually click the search button
if (!foundUsers.length) {
// If it's NIP05 send request to .well-known
if (userSearchInput.includes('@')) {
// If it's NIP05 (includes @ or is a valid domain) send request to .well-known
const domainRegex = /^[a-zA-Z0-9@.-]+\.[a-zA-Z]{2,}$/
if (domainRegex.test(userSearchInput)) {
setSearchUsersLoading(true)
const pubkey = await handleSearchUserNip05(userSearchInput)
setSearchUsersLoading(false)
if (pubkey) {
setUserInput(userSearchInput)
} else {