Skip to content

Commit b0c367c

Browse files
NeiruBugzHaarolean
authored andcommitted
FE: Fix HTTP 400 for clusters with special symbols (#3591)
(cherry picked from commit ecc8db1)
1 parent d10996e commit b0c367c

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

kafka-ui-react-app/src/components/Topics/Topic/Messages/Filters/Filters.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,9 @@ const Filters: React.FC<FiltersProps> = ({
327327
// eslint-disable-next-line consistent-return
328328
React.useEffect(() => {
329329
if (location.search?.length !== 0) {
330-
const url = `${BASE_PARAMS.basePath}/api/clusters/${clusterName}/topics/${topicName}/messages${location.search}`;
330+
const url = `${BASE_PARAMS.basePath}/api/clusters/${encodeURIComponent(
331+
clusterName
332+
)}/topics/${topicName}/messages${location.search}`;
331333
const sse = new EventSource(url);
332334

333335
source.current = sse;

kafka-ui-react-app/src/lib/hooks/api/ksqlDb.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ export const useKsqlkDbSSE = ({ clusterName, pipeId }: UseKsqlkDbSSEProps) => {
9090

9191
React.useEffect(() => {
9292
const fetchData = async () => {
93-
const url = `${BASE_PARAMS.basePath}/api/clusters/${clusterName}/ksql/response`;
93+
const url = `${BASE_PARAMS.basePath}/api/clusters/${encodeURIComponent(
94+
clusterName
95+
)}/ksql/response`;
9496
await fetchEventSource(
9597
`${url}?${new URLSearchParams({ pipeId: pipeId || '' }).toString()}`,
9698
{

kafka-ui-react-app/src/lib/hooks/api/topicMessages.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ export const useTopicMessages = ({
5151
React.useEffect(() => {
5252
const fetchData = async () => {
5353
setIsFetching(true);
54-
const url = `${BASE_PARAMS.basePath}/api/clusters/${clusterName}/topics/${topicName}/messages`;
54+
const url = `${BASE_PARAMS.basePath}/api/clusters/${encodeURIComponent(
55+
clusterName
56+
)}/topics/${topicName}/messages`;
5557
const requestParams = new URLSearchParams({
5658
limit,
5759
seekTo: seekTo.replaceAll('-', '::').replaceAll('.', ','),

0 commit comments

Comments
 (0)