diff --git a/libs/importer/src/importers/chrome-csv-importer.spec.ts b/libs/importer/src/importers/chrome-csv-importer.spec.ts index d0e82cf44ac..a7a29094707 100644 --- a/libs/importer/src/importers/chrome-csv-importer.spec.ts +++ b/libs/importer/src/importers/chrome-csv-importer.spec.ts @@ -20,7 +20,7 @@ const CipherData = [ password: "Qh6W4Wz55YGFNU", uris: [ Object.assign(new LoginUriView(), { - uri: "android://N2H9MndUUUt3JuQSWAKexOU9oJLJeHR4nyUGac5E1TXKppkY7xtdRl6l8vKo1hQWCqAEy4gsNLUBIbVxpdmhOP==@com.xyz.example.app.android/", + uri: "androidapp://com.xyz.example.app.android", }), ], }), diff --git a/libs/importer/src/importers/chrome-csv-importer.ts b/libs/importer/src/importers/chrome-csv-importer.ts index c7a72c126b0..7b663c57a2f 100644 --- a/libs/importer/src/importers/chrome-csv-importer.ts +++ b/libs/importer/src/importers/chrome-csv-importer.ts @@ -6,6 +6,11 @@ import { Importer } from "./importer"; export class ChromeCsvImporter extends BaseImporter implements Importer { private androidPatternRegex = new RegExp("^android:\\/\\/.*(?<=@)(.*)(?=\\/)"); + private normalizeAndroidUrl(url: string): string { + const match = url?.match(this.androidPatternRegex); + return match ? `androidapp://${match[1]}` : url; + } + parse(data: string): Promise { const result = new ImportResult(); const results = this.parseCsv(data, true); @@ -16,6 +21,8 @@ export class ChromeCsvImporter extends BaseImporter implements Importer { results.forEach((value) => { const cipher = this.initLoginCipher(); + const normalizedUri = this.normalizeAndroidUrl(value.url); + let name = value.name; if (!name && this.androidPatternRegex.test(value.url)) { name = value.url.match(this.androidPatternRegex)[1]; @@ -23,7 +30,7 @@ export class ChromeCsvImporter extends BaseImporter implements Importer { 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); + cipher.login.uris = this.makeUriArray(normalizedUri); cipher.notes = this.getValueOrDefault(value.note); this.cleanupCipher(cipher); result.ciphers.push(cipher);