Pārlūkot izejas kodu

Also include same workaround as mobile app

Manav Rathi 1 gadu atpakaļ
vecāks
revīzija
eaf8b9cebc
1 mainītis faili ar 13 papildinājumiem un 0 dzēšanām
  1. 13 0
      web/apps/auth/src/services/code.ts

+ 13 - 0
web/apps/auth/src/services/code.ts

@@ -49,6 +49,19 @@ export interface Code {
  * See also `auth/test/models/code_test.dart`.
  */
 export const codeFromURIString = (id: string, uriString: string): Code => {
+    try {
+        return _codeFromURIString(id, uriString);
+    } catch (e) {
+        // We might have legacy encodings of account names that contain a "#",
+        // which causes the rest of the URL to be treated as a fragment, and
+        // ignored. See if this was potentially such a case, otherwise rethrow.
+        if (uriString.includes("#"))
+            return _codeFromURIString(id, uriString.replaceAll("#", "%23"));
+        throw e;
+    }
+};
+
+const _codeFromURIString = (id: string, uriString: string): Code => {
     const url = new URL(uriString);
 
     return {