Skip to content

Commit

Permalink
FE: Fix HTTP 400 for clusters with special symbols (#3591)
Browse files Browse the repository at this point in the history
(cherry picked from commit ecc8db1)
  • Loading branch information
NeiruBugz authored and Haarolean committed Apr 13, 2023
1 parent d10996e commit b0c367c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,9 @@ const Filters: React.FC<FiltersProps> = ({
// eslint-disable-next-line consistent-return
React.useEffect(() => {
if (location.search?.length !== 0) {
const url = `${BASE_PARAMS.basePath}/api/clusters/${clusterName}/topics/${topicName}/messages${location.search}`;
const url = `${BASE_PARAMS.basePath}/api/clusters/${encodeURIComponent(
clusterName
)}/topics/${topicName}/messages${location.search}`;
const sse = new EventSource(url);

source.current = sse;
Expand Down
4 changes: 3 additions & 1 deletion kafka-ui-react-app/src/lib/hooks/api/ksqlDb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ export const useKsqlkDbSSE = ({ clusterName, pipeId }: UseKsqlkDbSSEProps) => {

React.useEffect(() => {
const fetchData = async () => {
const url = `${BASE_PARAMS.basePath}/api/clusters/${clusterName}/ksql/response`;
const url = `${BASE_PARAMS.basePath}/api/clusters/${encodeURIComponent(
clusterName
)}/ksql/response`;
await fetchEventSource(
`${url}?${new URLSearchParams({ pipeId: pipeId || '' }).toString()}`,
{
Expand Down
4 changes: 3 additions & 1 deletion kafka-ui-react-app/src/lib/hooks/api/topicMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export const useTopicMessages = ({
React.useEffect(() => {
const fetchData = async () => {
setIsFetching(true);
const url = `${BASE_PARAMS.basePath}/api/clusters/${clusterName}/topics/${topicName}/messages`;
const url = `${BASE_PARAMS.basePath}/api/clusters/${encodeURIComponent(
clusterName
)}/topics/${topicName}/messages`;
const requestParams = new URLSearchParams({
limit,
seekTo: seekTo.replaceAll('-', '::').replaceAll('.', ','),
Expand Down

0 comments on commit b0c367c

Please sign in to comment.