Skip to content

Commit

Permalink
PR remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd committed May 11, 2023
1 parent 709a5df commit 5838201
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/plugin/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (d *Datasource) getColumns(ctx context.Context, database, table string) ([]
return cached.([]string), 0, nil
}

resp, err := d.executeQuery(ctx, database, fmt.Sprintf(`SELECT SNELLER_DATASHAPE(*) FROM (SELECT * FROM %s LIMIT 1000)`, table))
resp, err := d.executeQuery(ctx, database, fmt.Sprintf(`SELECT SNELLER_DATASHAPE(*) FROM (SELECT * FROM %q LIMIT 1000)`, table))
if err != nil {
if resp != nil {
return nil, resp.StatusCode, err
Expand Down
6 changes: 4 additions & 2 deletions src/components/QueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function QueryEditor({ datasource, query, onChange, onRunQuery }: Props)
return []
}
try {
const response = await datasource.getResource('tables/' + database) as string[];
const response = await datasource.getResource('tables/' + encodeURIComponent(database)) as string[];
return (response.map((x) => ({
name: x,
})));
Expand All @@ -55,7 +55,9 @@ export function QueryEditor({ datasource, query, onChange, onRunQuery }: Props)
return []
}
try {
const response = await datasource.getResource('columns/' + database + '/' + table.table) as string[];
const response = await datasource.getResource(
'columns/' + encodeURIComponent(database) + '/' + encodeURIComponent(table.table)
) as string[];
return (response.map((x) => ({
name: x,
})));
Expand Down

0 comments on commit 5838201

Please sign in to comment.