From 1c3ebd026b0ca3d7c7bd7326db4e21beffff3bc0 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Mon, 3 Apr 2023 12:13:43 +0530 Subject: [PATCH] Fix: Parsing of account name --- lib/models/code.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/models/code.dart b/lib/models/code.dart index c323625efd..4eb9b0d0b9 100644 --- a/lib/models/code.dart +++ b/lib/models/code.dart @@ -68,6 +68,11 @@ class Code { static String _getAccount(Uri uri) { try { final String path = Uri.decodeComponent(uri.path); + // Parse account name from documented auth URI + // otpauth://totp/ACCOUNT?secret=SUPERSECRET&issuer=SERVICE + if (uri.queryParameters.containsKey("issuer") && !path.contains(":")) { + return path; + } return path.split(':')[1]; } catch (e) { return "";