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:
@@ -155,15 +155,16 @@ 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])) {
|
||||
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 {
|
||||
await this.postImport(importResult, organizationId);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user