From ae803c5c5ff81f4a2acc6524fdba8b70d2f215cc Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Wed, 12 Feb 2020 14:01:51 -0500 Subject: [PATCH] Support importing raw string and naming the import --- packages/insomnia-app/app/common/import.js | 3 ++- packages/insomnia-app/app/ui/redux/modules/global.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/insomnia-app/app/common/import.js b/packages/insomnia-app/app/common/import.js index bdd35d08b..832b0a4d7 100644 --- a/packages/insomnia-app/app/common/import.js +++ b/packages/insomnia-app/app/common/import.js @@ -50,7 +50,8 @@ export async function importUri( const path = uri.replace(/^(file):\/\//, ''); rawText = fs.readFileSync(path, 'utf8'); } else { - throw new Error(`Invalid import URI ${uri}`); + // Treat everything else as raw text + rawText = decodeURIComponent(uri); } const result = await importRaw(getWorkspaceId, rawText); diff --git a/packages/insomnia-app/app/ui/redux/modules/global.js b/packages/insomnia-app/app/ui/redux/modules/global.js index 71d3347cf..41a196288 100644 --- a/packages/insomnia-app/app/ui/redux/modules/global.js +++ b/packages/insomnia-app/app/ui/redux/modules/global.js @@ -103,7 +103,7 @@ export function newCommand(command, args) { title: 'Confirm Data Import', message: ( - Do you really want to import {args.uri}? + Do you really want to import {args.name || args.uri}? ), addCancel: true,