Skip to content

Commit

Permalink
fix: Unable to sync columns when dataset name has '+' (#21019)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomedina248 authored Aug 16, 2022
1 parent b303d1e commit 0c84203
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});

Expand All @@ -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');

Expand All @@ -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);
Expand Down

0 comments on commit 0c84203

Please sign in to comment.