From c9c07929fa89b24dca2015a8c20800890b2977f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDiga=20Kokelj?= Date: Wed, 3 Apr 2024 20:05:35 +0200 Subject: [PATCH] fix --- tools/walletextension/httpapi/utils.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/walletextension/httpapi/utils.go b/tools/walletextension/httpapi/utils.go index c7acc16b8c..e367856abc 100644 --- a/tools/walletextension/httpapi/utils.go +++ b/tools/walletextension/httpapi/utils.go @@ -25,10 +25,13 @@ func getUserID(conn UserConn) ([]byte, error) { // try getting userID (`token`) from query parameters and return it if successful userID, err := getQueryParameter(conn.ReadRequestParams(), common.EncryptedTokenQueryParameter) if err == nil { - if len(userID) != common.MessageUserIDLenWithPrefix { - return nil, fmt.Errorf(fmt.Sprintf("wrong length of userID from URL. Got: %d, Expected: %d", len(userID), common.MessageUserIDLenWithPrefix)) + if len(userID) == common.MessageUserIDLenWithPrefix { + return hexutils.HexToBytes(userID[2:]), nil + } else if len(userID) == common.MessageUserIDLen { + return hexutils.HexToBytes(userID), nil } - return hexutils.HexToBytes(userID[2:]), err + + return nil, fmt.Errorf(fmt.Sprintf("wrong length of userID from URL. Got: %d, Expected: %d od %d", len(userID), common.MessageUserIDLenWithPrefix, common.MessageUserIDLen)) } return nil, fmt.Errorf("missing token field")