From 731c7633c345502638e5d98fabcdef000df61501 Mon Sep 17 00:00:00 2001 From: Scott J Dickerson Date: Mon, 15 Jul 2024 15:52:31 -0400 Subject: [PATCH] :bug: Don't use "mvn://::" for an empty binary source in applications When creating an application, if the "Binary (Java)" source is not specified, we want to store an empty string as the `binary` value and not `"mvn://::`. This also applied to editing an existing application. Signed-off-by: Scott J Dickerson --- .../application-form/application-form.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/client/src/app/pages/applications/components/application-form/application-form.tsx b/client/src/app/pages/applications/components/application-form/application-form.tsx index ab3a5cb7c3..d3164386fc 100644 --- a/client/src/app/pages/applications/components/application-form/application-form.tsx +++ b/client/src/app/pages/applications/components/application-form/application-form.tsx @@ -263,12 +263,12 @@ export const useApplicationFormHook = ({ }); const onValidSubmit = (formValues: FormValues) => { - let binaryValue = formValues.packaging - ? `${formValues.group}:${formValues.artifact}:${formValues.version}:${formValues.packaging}` - : `${formValues.group}:${formValues.artifact}:${formValues.version}`; - if (!binaryValue.startsWith("mvn://")) { - binaryValue = `mvn://${binaryValue}`; - } + const binaryValues = [ + formValues.group, + formValues.artifact, + formValues.version, + formValues.packaging, + ].filter(Boolean); const payload: New = { name: formValues.name.trim(), @@ -294,7 +294,8 @@ export const useApplicationFormHook = ({ path: formValues.rootPath.trim(), } : undefined, - binary: binaryValue, + binary: + binaryValues.length > 0 ? `mvn://${binaryValues.join(":")}` : undefined, // Values not editable on the form but still need to be passed through identities: application?.identities ?? undefined,