mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-24 17:51:14 +02:00
fix: encode application name
This commit is contained in:
parent
bcbe3eb0ba
commit
834f4e3985
@ -78,7 +78,7 @@ export const Application = () => {
|
|||||||
const { setToastData, setToastApiError } = useToast();
|
const { setToastData, setToastApiError } = useToast();
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
|
|
||||||
const basePath = `/applications/${name}`;
|
const basePath = `/applications/${encodeURIComponent(name)}`;
|
||||||
|
|
||||||
const [showDialog, setShowDialog] = useState(false);
|
const [showDialog, setShowDialog] = useState(false);
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ export const PaginatedApplicationList = () => {
|
|||||||
}: any) => (
|
}: any) => (
|
||||||
<LinkCell
|
<LinkCell
|
||||||
title={appName}
|
title={appName}
|
||||||
to={`/applications/${appName}`}
|
to={`/applications/${encodeURIComponent(appName)}`}
|
||||||
subtitle={description}
|
subtitle={description}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
@ -99,7 +99,9 @@ export const ProjectApplications = () => {
|
|||||||
title={row.original.name}
|
title={row.original.name}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
trackProjectApplicationClick();
|
trackProjectApplicationClick();
|
||||||
navigate(`/applications/${row.original.name}`);
|
navigate(
|
||||||
|
`/applications/${encodeURIComponent(row.original.name)}`,
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
@ -16,7 +16,8 @@ const useApplication = (
|
|||||||
name: string,
|
name: string,
|
||||||
options: SWRConfiguration = {},
|
options: SWRConfiguration = {},
|
||||||
): IUseApplicationOutput => {
|
): IUseApplicationOutput => {
|
||||||
const path = formatApiPath(`api/admin/metrics/applications/${name}`);
|
const encodedName = encodeURIComponent(name);
|
||||||
|
const path = formatApiPath(`api/admin/metrics/applications/${encodedName}`);
|
||||||
|
|
||||||
const fetcher = async () => {
|
const fetcher = async () => {
|
||||||
return fetch(path, {
|
return fetch(path, {
|
||||||
@ -26,7 +27,7 @@ const useApplication = (
|
|||||||
.then((res) => res.json());
|
.then((res) => res.json());
|
||||||
};
|
};
|
||||||
|
|
||||||
const APPLICATION_CACHE_KEY = `api/admin/metrics/applications/${name}`;
|
const APPLICATION_CACHE_KEY = `api/admin/metrics/applications/${encodedName}`;
|
||||||
|
|
||||||
const { data, error } = useSWR(APPLICATION_CACHE_KEY, fetcher, {
|
const { data, error } = useSWR(APPLICATION_CACHE_KEY, fetcher, {
|
||||||
...options,
|
...options,
|
||||||
@ -44,7 +45,7 @@ const useApplication = (
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
application: data || {
|
application: data || {
|
||||||
appName: name,
|
appName: encodedName,
|
||||||
color: '',
|
color: '',
|
||||||
createdAt: '2022-02-02T21:04:00.268Z',
|
createdAt: '2022-02-02T21:04:00.268Z',
|
||||||
description: '',
|
description: '',
|
||||||
|
@ -15,8 +15,9 @@ export const useApplicationOverview = (
|
|||||||
application: string,
|
application: string,
|
||||||
options: SWRConfiguration = {},
|
options: SWRConfiguration = {},
|
||||||
) => {
|
) => {
|
||||||
|
const encodedApplication = encodeURIComponent(application);
|
||||||
const path = formatApiPath(
|
const path = formatApiPath(
|
||||||
`api/admin/metrics/applications/${application}/overview`,
|
`api/admin/metrics/applications/${encodedApplication}/overview`,
|
||||||
);
|
);
|
||||||
const { data, error } = useSWR<ApplicationOverviewSchema>(
|
const { data, error } = useSWR<ApplicationOverviewSchema>(
|
||||||
path,
|
path,
|
||||||
|
@ -17,8 +17,9 @@ export const useConnectedInstances = (
|
|||||||
environment?: string,
|
environment?: string,
|
||||||
options: SWRConfiguration = {},
|
options: SWRConfiguration = {},
|
||||||
) => {
|
) => {
|
||||||
|
const encodedApplication = encodeURIComponent(application);
|
||||||
const path = formatApiPath(
|
const path = formatApiPath(
|
||||||
`api/admin/metrics/instances/${application}/environment/${environment}`,
|
`api/admin/metrics/instances/${encodedApplication}/environment/${environment}`,
|
||||||
);
|
);
|
||||||
const { data, error } = useConditionalSWR<ConnectedInstancesSchema>(
|
const { data, error } = useConditionalSWR<ConnectedInstancesSchema>(
|
||||||
Boolean(environment),
|
Boolean(environment),
|
||||||
|
Loading…
Reference in New Issue
Block a user