You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2022/08/16 13:55:33 UTC

[superset] branch master updated: fix: Unable to sync columns when dataset name has '+' (#21019)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 0c84203053 fix: Unable to sync columns when dataset name has '+' (#21019)
0c84203053 is described below

commit 0c8420305368e1ea54deb48535dff77b2c84ba38
Author: Diego Medina <di...@gmail.com>
AuthorDate: Tue Aug 16 10:55:27 2022 -0300

    fix: Unable to sync columns when dataset name has '+' (#21019)
---
 .../src/components/Datasource/DatasourceEditor.jsx           |  4 +++-
 .../src/components/Datasource/DatasourceEditor.test.jsx      | 12 ++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx
index bf524c2210..260cf5eab7 100644
--- a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx
+++ b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx
@@ -741,7 +741,9 @@ class DatasourceEditor extends React.PureComponent {
       database_name:
         datasource.database.database_name || datasource.database.name,
       schema_name: datasource.schema,
-      table_name: datasource.table_name,
+      table_name: datasource.table_name
+        ? encodeURIComponent(datasource.table_name)
+        : datasource.table_name,
     };
     Object.entries(params).forEach(([key, value]) => {
       // rison can't encode the undefined value
diff --git a/superset-frontend/src/components/Datasource/DatasourceEditor.test.jsx b/superset-frontend/src/components/Datasource/DatasourceEditor.test.jsx
index 7ad7b9f9a8..b6e43d2913 100644
--- a/superset-frontend/src/components/Datasource/DatasourceEditor.test.jsx
+++ b/superset-frontend/src/components/Datasource/DatasourceEditor.test.jsx
@@ -39,7 +39,12 @@ describe('DatasourceEditor', () => {
   let isFeatureEnabledMock;
 
   beforeEach(() => {
-    el = <DatasourceEditor {...props} />;
+    el = (
+      <DatasourceEditor
+        {...props}
+        datasource={{ ...props.datasource, table_name: 'Vehicle Sales +' }}
+      />
+    );
     render(el, { useRedux: true });
   });
 
@@ -51,7 +56,7 @@ describe('DatasourceEditor', () => {
     expect(screen.getByTestId('edit-dataset-tabs')).toBeInTheDocument();
   });
 
-  it('makes an async request', () =>
+  it('can sync columns from source', () =>
     new Promise(done => {
       const columnsTab = screen.getByTestId('collection-tab-Columns');
 
@@ -63,6 +68,9 @@ describe('DatasourceEditor', () => {
 
       setTimeout(() => {
         expect(fetchMock.calls(DATASOURCE_ENDPOINT)).toHaveLength(1);
+        expect(fetchMock.calls(DATASOURCE_ENDPOINT)[0][0]).toContain(
+          'Vehicle%20Sales%20%2B%27',
+        );
         fetchMock.reset();
         done();
       }, 0);