From 98cfe1b806851060ec1366b2315d0a42f4d83e98 Mon Sep 17 00:00:00 2001 From: Daniel James Smith <2670567+djsmith85@users.noreply.github.com> Date: Tue, 19 Sep 2023 11:05:05 +0200 Subject: [PATCH] 1password1pux importer can import json (#6049) The .1pux-format is technically just a ziup-file that contain a file named `export.data`which is a json file. These changes add support to upload either a 1pux or the export.data file directly. The thought to change this came through the recent addtion of the ProtonPass importer. Co-authored-by: Daniel James Smith --- apps/cli/src/tools/import.command.ts | 2 +- apps/web/src/app/tools/import-export/import.component.ts | 2 +- libs/importer/src/models/import-options.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/cli/src/tools/import.command.ts b/apps/cli/src/tools/import.command.ts index c013d3c6b6..e3f24b960f 100644 --- a/apps/cli/src/tools/import.command.ts +++ b/apps/cli/src/tools/import.command.ts @@ -66,7 +66,7 @@ export class ImportCommand { try { let contents; - if (format === "1password1pux") { + if (format === "1password1pux" && filepath.endsWith(".1pux")) { contents = await CliUtils.extractZipContent(filepath, "export.data"); } else if (format === "protonpass" && filepath.endsWith(".zip")) { contents = await CliUtils.extractZipContent(filepath, "Proton Pass/data.json"); diff --git a/apps/web/src/app/tools/import-export/import.component.ts b/apps/web/src/app/tools/import-export/import.component.ts index fb7d1d5501..de2de35777 100644 --- a/apps/web/src/app/tools/import-export/import.component.ts +++ b/apps/web/src/app/tools/import-export/import.component.ts @@ -309,7 +309,7 @@ export class ImportComponent implements OnInit, OnDestroy { } private getFileContents(file: File): Promise { - if (this.format === "1password1pux") { + if (this.format === "1password1pux" && file.name.endsWith(".1pux")) { return this.extractZipContent(file, "export.data"); } if ( diff --git a/libs/importer/src/models/import-options.ts b/libs/importer/src/models/import-options.ts index 2afe801d20..03c4e72e04 100644 --- a/libs/importer/src/models/import-options.ts +++ b/libs/importer/src/models/import-options.ts @@ -12,7 +12,7 @@ export const featuredImportOptions = [ { id: "keepass2xml", name: "KeePass 2 (xml)" }, { id: "lastpasscsv", name: "LastPass (csv)" }, { id: "safaricsv", name: "Safari and macOS (csv)" }, - { id: "1password1pux", name: "1Password (1pux)" }, + { id: "1password1pux", name: "1Password (1pux/json)" }, ] as const; export const regularImportOptions = [