From b6a5ccbf1001b04215400a0e5581b0bd3f6d2cf3 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 17 Aug 2022 11:01:25 +0100 Subject: [PATCH] Adding some controls around datasource config creation and updating minio fetch. --- .../DatasourceNavigator/modals/DatasourceConfigModal.svelte | 3 +++ packages/server/src/utilities/fileSystem/index.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte b/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte index ecfd838b16..c8a5bc96eb 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte @@ -19,6 +19,9 @@ async function saveDatasource() { try { + if (!datasource.name) { + datasource.name = name + } const resp = await save(datasource, skipFetch) $goto(`./datasource/${resp._id}`) notifications.success(`Datasource updated successfully.`) diff --git a/packages/server/src/utilities/fileSystem/index.js b/packages/server/src/utilities/fileSystem/index.js index 9b124d6c29..d65ee48f05 100644 --- a/packages/server/src/utilities/fileSystem/index.js +++ b/packages/server/src/utilities/fileSystem/index.js @@ -17,6 +17,7 @@ const { downloadTarball, } = require("./utilities") const { updateClientLibrary } = require("./clientLibrary") +const { checkSlashesInUrl } = require("../") const env = require("../../environment") const { USER_METDATA_PREFIX, @@ -358,7 +359,7 @@ exports.getDatasourcePlugin = async (name, url) => { if (fs.existsSync(filename)) { return require(filename) } - const response = fetch(url) + const response = await fetch(checkSlashesInUrl(`${env.MINIO_URL}/${url}`)) if (response.status === 200) { const content = await response.text() fs.writeFileSync(filename, content)