1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-22 19:23:24 +00:00

Increase error checking on imported Login items

This commit is contained in:
Thomas Rittson
2021-05-05 11:57:56 +10:00
parent a72c8a60c1
commit 1729452786

View File

@@ -155,13 +155,14 @@ export class ImportService implements ImportServiceAbstraction {
if (importResult.folders.length === 0 && importResult.ciphers.length === 0) { if (importResult.folders.length === 0 && importResult.ciphers.length === 0) {
return new Error(this.i18nService.t('importNothingError')); return new Error(this.i18nService.t('importNothingError'));
} else if (importResult.ciphers.length > 0) { } else if (importResult.ciphers.length > 0) {
const halfway = Math.floor(importResult.ciphers.length / 2); let badDataThreshold = 10;
const last = importResult.ciphers.length - 1; for (const cipher of importResult.ciphers) {
if (this.badData(cipher)) {
if (this.badData(importResult.ciphers[0]) && badDataThreshold--;
this.badData(importResult.ciphers[halfway]) && if (badDataThreshold === 0) {
this.badData(importResult.ciphers[last])) { return new Error(this.i18nService.t('importFormatError'));
return new Error(this.i18nService.t('importFormatError')); }
}
} }
} }
try { try {