Skip to content
This repository was archived by the owner on Apr 12, 2026. It is now read-only.

Commit 9efb793

Browse files
authored
[sql] Fix query encoding in panel actions (#425)
The query parameter was not encoded in the panel actions, so that the a users query broke, when he selected a query in the action and was redirected to the raw view of his data. This is now fixed by using "encodeURIComponent" for the query parameter in the actions of an sql panel.
1 parent 0943384 commit 9efb793

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

plugins/plugin-sql/src/components/panel/SQLActions.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ export const SQLActions: React.FunctionComponent<ISQLActionsProps> = ({
3131
dropdownItems={queries.map((query, index) => (
3232
<DropdownItem
3333
key={index}
34-
component={<Link to={`${pluginBasePath(instance)}?query=${query.query}`}>{query.name}</Link>}
34+
component={
35+
<Link to={`${pluginBasePath(instance)}?query=${encodeURIComponent(query.query || '')}`}>
36+
{query.name}
37+
</Link>
38+
}
3539
/>
3640
))}
3741
/>

plugins/plugin-sql/src/components/panel/SQLChartActions.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export const SQLChartActions: React.FunctionComponent<ISQLChartActionsProps> = (
2828
isPlain={true}
2929
position="right"
3030
dropdownItems={[
31-
<DropdownItem key={0} component={<Link to={`${pluginBasePath(instance)}?query=${query}`}>Explore</Link>} />,
31+
<DropdownItem
32+
key={0}
33+
component={<Link to={`${pluginBasePath(instance)}?query=${encodeURIComponent(query)}`}>Explore</Link>}
34+
/>,
3235
]}
3336
/>
3437
)}

0 commit comments

Comments
 (0)