mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 07:13:32 +00:00
[EC-417] Extracting the app name from the Android user item on CSV import (#3254)
* [EC-417] Extracting the app name from the Android user item on CSV import * [EC-417] Updated android csv pattern to match starting with 'android://' * [EC-417] Added unit tests for ChromeCsvImporter
This commit is contained in:
@@ -4,6 +4,8 @@ import { BaseImporter } from "./baseImporter";
|
||||
import { Importer } from "./importer";
|
||||
|
||||
export class ChromeCsvImporter extends BaseImporter implements Importer {
|
||||
private androidPatternRegex = new RegExp("^android:\\/\\/.*(?<=@)(.*)(?=\\/)");
|
||||
|
||||
parse(data: string): Promise<ImportResult> {
|
||||
const result = new ImportResult();
|
||||
const results = this.parseCsv(data, true);
|
||||
@@ -14,7 +16,11 @@ export class ChromeCsvImporter extends BaseImporter implements Importer {
|
||||
|
||||
results.forEach((value) => {
|
||||
const cipher = this.initLoginCipher();
|
||||
cipher.name = this.getValueOrDefault(value.name, "--");
|
||||
let name = value.name;
|
||||
if (!name && this.androidPatternRegex.test(value.url)) {
|
||||
name = value.url.match(this.androidPatternRegex)[1];
|
||||
}
|
||||
cipher.name = this.getValueOrDefault(name, "--");
|
||||
cipher.login.username = this.getValueOrDefault(value.username);
|
||||
cipher.login.password = this.getValueOrDefault(value.password);
|
||||
cipher.login.uris = this.makeUriArray(value.url);
|
||||
|
||||
Reference in New Issue
Block a user