Support importing raw string and naming the import

This commit is contained in:
Gregory Schier 2020-02-12 14:01:51 -05:00
parent 973f31e1f1
commit ae803c5c5f
2 changed files with 3 additions and 2 deletions

View File

@ -50,7 +50,8 @@ export async function importUri(
const path = uri.replace(/^(file):\/\//, ''); const path = uri.replace(/^(file):\/\//, '');
rawText = fs.readFileSync(path, 'utf8'); rawText = fs.readFileSync(path, 'utf8');
} else { } else {
throw new Error(`Invalid import URI ${uri}`); // Treat everything else as raw text
rawText = decodeURIComponent(uri);
} }
const result = await importRaw(getWorkspaceId, rawText); const result = await importRaw(getWorkspaceId, rawText);

View File

@ -103,7 +103,7 @@ export function newCommand(command, args) {
title: 'Confirm Data Import', title: 'Confirm Data Import',
message: ( message: (
<span> <span>
Do you really want to import <code>{args.uri}</code>? Do you really want to import <code>{args.name || args.uri}</code>?
</span> </span>
), ),
addCancel: true, addCancel: true,