From 17294527863cc53b84ed218f94ffbc21f4e96260 Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Wed, 5 May 2021 11:57:56 +1000 Subject: [PATCH] Increase error checking on imported Login items --- src/services/import.service.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/services/import.service.ts b/src/services/import.service.ts index 4f4364eb..dce94cd4 100644 --- a/src/services/import.service.ts +++ b/src/services/import.service.ts @@ -155,13 +155,14 @@ export class ImportService implements ImportServiceAbstraction { if (importResult.folders.length === 0 && importResult.ciphers.length === 0) { return new Error(this.i18nService.t('importNothingError')); } else if (importResult.ciphers.length > 0) { - const halfway = Math.floor(importResult.ciphers.length / 2); - const last = importResult.ciphers.length - 1; - - if (this.badData(importResult.ciphers[0]) && - this.badData(importResult.ciphers[halfway]) && - this.badData(importResult.ciphers[last])) { - return new Error(this.i18nService.t('importFormatError')); + let badDataThreshold = 10; + for (const cipher of importResult.ciphers) { + if (this.badData(cipher)) { + badDataThreshold--; + if (badDataThreshold === 0) { + return new Error(this.i18nService.t('importFormatError')); + } + } } } try {