From b9ddb503ee066d08117400f2ba135ebd411bbb40 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Tue, 16 Jun 2020 13:46:02 -0400 Subject: [PATCH] make sure that secret is defined before trying to decode (#479) Signed-off-by: Sebastian Malton Co-authored-by: Sebastian Malton --- .../+workloads-pods/pod-container-env.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dashboard/client/components/+workloads-pods/pod-container-env.tsx b/dashboard/client/components/+workloads-pods/pod-container-env.tsx index 2896a06215..f5cce6fa8c 100644 --- a/dashboard/client/components/+workloads-pods/pod-container-env.tsx +++ b/dashboard/client/components/+workloads-pods/pod-container-env.tsx @@ -120,8 +120,11 @@ const SecretKey = (props: SecretKeyProps) => { setSecret(secret) } - if (!secret) { - return ( + if (secret?.data?.[key]) { + return <>{base64.decode(secret.data[key])} + } + + return ( <> secretKeyRef({name}.{key})  { onClick={showKey} /> - ) - } - return <>{base64.decode(secret.data[key])} -} \ No newline at end of file + ) +}