Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Preserve archive limit errors for legacy Auth imports

Neeraj Guptabb6f30e4095e
diff --git a/mobile/apps/auth/lib/ui/settings/data/import/otp_auth_import_parser.dart b/mobile/apps/auth/lib/ui/settings/data/import/otp_auth_import_parser.dart
index 339ebd731f..7c8e016925 100644
--- a/mobile/apps/auth/lib/ui/settings/data/import/otp_auth_import_parser.dart
+++ b/mobile/apps/auth/lib/ui/settings/data/import/otp_auth_import_parser.dart
@@ -45,6 +45,8 @@ List<Code> parseOtpAuthExport(Uint8List fileBytes, {required String password}) {
late final Map<String, Object?> root;
try {
root = _asMap(_unarchive(decryptedData));
+ } on _ArchiveExpansionLimitException {
+ rethrow;
} catch (_) {
if (isLegacy) throw const IncorrectOtpAuthPasswordException();
rethrow;
@@ -211,12 +213,17 @@ class _ArchiveBudget {
void consume(int amount) {
if (amount < 0 || amount > remaining) {
- throw const FormatException('OTP Auth archive expansion limit exceeded');
+ throw const _ArchiveExpansionLimitException();
}
remaining -= amount;
}
}
+class _ArchiveExpansionLimitException extends FormatException {
+ const _ArchiveExpansionLimitException()
+ : super('OTP Auth archive expansion limit exceeded');
+}
+
class _KeyedArchive {
late final List<Object?> _objects;
final _cache = <int, ({Object? value, int cost})>{};