Skip to content

Commit

Permalink
fix: openPod should redirect to the pod's view
Browse files Browse the repository at this point in the history
was using invalid encoding scheme for the namespace

fixes podman-desktop#5774
Signed-off-by: Florent Benoit <[email protected]>
  • Loading branch information
benoitf committed Feb 5, 2024
1 parent 14705c7 commit 3a1ad68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/renderer/src/lib/pod/DeployPodToKube.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,12 @@ test('Should display Open pod button after successful deployment', async () => {

await waitFor(() =>
kubernetesCreatePodMock.mockResolvedValue({
metadata: { name: 'hello', namespace: 'default' },
metadata: { name: 'foobar/api-fake-cluster.com:6443', namespace: 'default' },
}),
);
await waitFor(() =>
kubernetesReadNamespacedPodMock.mockResolvedValue({
metadata: { name: 'hello' },
metadata: { name: 'foobar/api-fake-cluster.com:6443' },
status: {
phase: 'Running',
},
Expand All @@ -522,5 +522,5 @@ test('Should display Open pod button after successful deployment', async () => {
expect(openPodButton).toBeEnabled();

await fireEvent.click(openPodButton);
expect(router.goto).toHaveBeenCalledWith(`/pods/kubernetes/hello/default/logs`);
expect(router.goto).toHaveBeenCalledWith(`/pods/kubernetes/foobar%2Fapi-fake-cluster.com%3A6443/default/logs`);
});
4 changes: 3 additions & 1 deletion packages/renderer/src/lib/pod/DeployPodToKube.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ function openPodDetails(): void {
if (!createdPod?.metadata?.name || !defaultContextName) {
return;
}
router.goto(`/pods/kubernetes/${encodeURI(createdPod.metadata.name)}/${encodeURI(defaultContextName)}/logs`);
router.goto(
`/pods/kubernetes/${encodeURIComponent(createdPod.metadata.name)}/${encodeURIComponent(defaultContextName)}/logs`,
);
}
function openRoute(route: V1Route) {
Expand Down

0 comments on commit 3a1ad68

Please sign in to comment.