fix: Unable to sync columns when database or dataset name contains `+` (#25390)

This commit is contained in:
mapledan 2023-10-04 02:15:01 +08:00 committed by GitHub
parent e3244e9056
commit dbe0838f8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -762,9 +762,7 @@ class DatasourceEditor extends React.PureComponent {
database_name:
datasource.database.database_name || datasource.database.name,
schema_name: datasource.schema,
table_name: datasource.table_name
? encodeURIComponent(datasource.table_name)
: datasource.table_name,
table_name: datasource.table_name,
normalize_columns: datasource.normalize_columns,
always_filter_main_dttm: datasource.always_filter_main_dttm,
};
@ -774,7 +772,7 @@ class DatasourceEditor extends React.PureComponent {
params[key] = null;
}
});
const endpoint = `/datasource/external_metadata_by_name/?q=${rison.encode(
const endpoint = `/datasource/external_metadata_by_name/?q=${rison.encode_uri(
params,
)}`;
this.setState({ metadataLoading: true });

View File

@ -75,7 +75,7 @@ describe('DatasourceEditor', () => {
setTimeout(() => {
expect(fetchMock.calls(DATASOURCE_ENDPOINT)).toHaveLength(1);
expect(fetchMock.calls(DATASOURCE_ENDPOINT)[0][0]).toContain(
'Vehicle%20Sales%20%2B%27',
'Vehicle+Sales%20%2B',
);
fetchMock.reset();
done();