diff --git a/src/app_service/service/contacts/async_tasks.nim b/src/app_service/service/contacts/async_tasks.nim index b4663a7634..3f32ce46d0 100644 --- a/src/app_service/service/contacts/async_tasks.nim +++ b/src/app_service/service/contacts/async_tasks.nim @@ -8,8 +8,6 @@ include ../../../app/core/tasks/common # Async lookup ENS contact ################################################# -const PK_LENGTH_0X_INCLUDED = 132 - type LookupContactTaskArg = ref object of QObjectTaskArg value: string diff --git a/src/app_service/service/contacts/service.nim b/src/app_service/service/contacts/service.nim index a820c3c2d1..4480a862f2 100644 --- a/src/app_service/service/contacts/service.nim +++ b/src/app_service/service/contacts/service.nim @@ -16,6 +16,8 @@ import ../../../backend/utils as status_utils export contacts_dto, status_update_dto, contact_details +const PK_LENGTH_0X_INCLUDED = 132 + include async_tasks logScope: @@ -211,6 +213,16 @@ QtObject: result = self.fetchContact(id) if result.id.len == 0: + if(not id.startsWith("0x")): + debug "id is not in a hex format" + return + + var num64: int64 + let parsedChars = parseHex(id, num64) + if(parsedChars != PK_LENGTH_0X_INCLUDED): + debug "id doesn't have expected lenght" + return + let alias = self.generateAlias(id) let identicon = self.generateIdenticonURL(id) result = ContactsDto(