1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

Increase error checking on imported Login items (#369)

* Increase error checking on imported Login items

* Check encKey when importing encrypted JSON

* Fix style, use GUID as random string for test

* Revert "Increase error checking on imported Login items"

This reverts commit 17294527863cc53b84ed218f94ffbc21f4e96260.

* fix linting

* Fix tests
This commit is contained in:
Thomas Rittson
2021-05-13 10:58:59 +10:00
committed by GitHub
parent ba1a40af4e
commit 306aef73d4
4 changed files with 42 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
import { ApiService } from '../abstractions/api.service';
import { CipherService } from '../abstractions/cipher.service';
import { CollectionService } from '../abstractions/collection.service';
import { CryptoService } from '../abstractions/crypto.service';
import { FolderService } from '../abstractions/folder.service';
import { I18nService } from '../abstractions/i18n.service';
import {
@@ -143,7 +144,8 @@ export class ImportService implements ImportServiceAbstraction {
constructor(private cipherService: CipherService, private folderService: FolderService,
private apiService: ApiService, private i18nService: I18nService,
private collectionService: CollectionService, private platformUtilsService: PlatformUtilsService) { }
private collectionService: CollectionService, private platformUtilsService: PlatformUtilsService,
private cryptoService: CryptoService) { }
getImportOptions(): ImportOption[] {
return this.featuredImportOptions.concat(this.regularImportOptions);
@@ -172,7 +174,11 @@ export class ImportService implements ImportServiceAbstraction {
}
return null;
} else {
return new Error(this.i18nService.t('importFormatError'));
if (!Utils.isNullOrWhitespace(importResult.errorMessage)) {
return new Error(importResult.errorMessage);
} else {
return new Error(this.i18nService.t('importFormatError'));
}
}
}
@@ -194,7 +200,7 @@ export class ImportService implements ImportServiceAbstraction {
case 'bitwardencsv':
return new BitwardenCsvImporter();
case 'bitwardenjson':
return new BitwardenJsonImporter();
return new BitwardenJsonImporter(this.cryptoService, this.i18nService);
case 'lastpasscsv':
case 'passboltcsv':
return new LastPassCsvImporter();