From 975ef0e7d8ac6c6fa1575767f9da3ef0af5acd62 Mon Sep 17 00:00:00 2001 From: Omri Dan <61094771+omridan159@users.noreply.github.com> Date: Thu, 9 May 2024 14:17:06 +0300 Subject: [PATCH] fix: deeplink invalid error when importing privateKey via qr (#9569) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** A fix for this issue: https://github.com/MetaMask/metamask-mobile/issues/9517 ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .../DeeplinkManager/ParseManager/parseDeeplink.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/core/DeeplinkManager/ParseManager/parseDeeplink.ts b/app/core/DeeplinkManager/ParseManager/parseDeeplink.ts index 5192dc148f6..4c799701503 100644 --- a/app/core/DeeplinkManager/ParseManager/parseDeeplink.ts +++ b/app/core/DeeplinkManager/ParseManager/parseDeeplink.ts @@ -92,12 +92,13 @@ function parseDeeplink({ return true; } catch (error) { - Logger.error( - error as Error, - 'DeepLinkManager:parse error parsing deeplink', - ); + const isPrivateKey = url.length === 64; + if (error && !isPrivateKey) { + Logger.error( + error as Error, + 'DeepLinkManager:parse error parsing deeplink', + ); - if (error) { Alert.alert(strings('deeplink.invalid'), `Invalid URL: ${url}`); }