Skip to content

Commit 154c422

Browse files
committed
OCPBUGS-56087: restructure initializatio of stringData
previously when you tried to edit a Secret with binary data, the string data was initialized with a keypair with null value instead of an empty object, which resulted in errors when saving the secret without changes. After those changes we omit keypairs that have binary values.
1 parent 6f22825 commit 154c422

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

frontend/public/components/secrets/create-secret/SecretFormWrapper.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ export const SecretFormWrapper: React.FC<BaseEditSecretProps_> = (props) => {
4444
const [inProgress, setInProgress] = React.useState(false);
4545
const [error, setError] = React.useState();
4646
const [stringData, setStringData] = React.useState(
47-
_.mapValues(_.get(props.obj, 'data'), (value) => {
47+
Object.entries(props.obj?.data ?? {}).reduce<Record<string, string>>((acc, [key, value]) => {
4848
if (isBinary(null, Buffer.from(value, 'base64'))) {
4949
return null;
5050
}
51-
return value ? Base64.decode(value) : '';
52-
}),
51+
acc[key] = value ? Base64.decode(value) : '';
52+
return acc;
53+
}, {}),
5354
);
5455
const [base64StringData, setBase64StringData] = React.useState(props?.obj?.data ?? {});
5556
const [disableForm, setDisableForm] = React.useState(false);

0 commit comments

Comments
 (0)