diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/CSV/CSV.utils.test.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/CSV/CSV.utils.test.tsx index 4bb7a40a437..fd24dcee802 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/CSV/CSV.utils.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/CSV/CSV.utils.test.tsx @@ -10,6 +10,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { ExtensionDataProps } from '../../components/Modals/ModalWithCustomProperty/ModalWithMarkdownEditor.interface'; import { EntityType } from '../../enums/entity.enum'; import { MOCK_GLOSSARY_TERM_CUSTOM_PROPERTIES, @@ -163,5 +164,14 @@ describe('CSVUtils', () => { MOCK_GLOSSARY_TERM_CUSTOM_PROPERTIES_CONVERTED_EXTENSION_CSV_STRING ); }); + + it('should return string correctly which contains undefined as value for property', () => { + const convertedCSVEntities = convertEntityExtensionToCustomPropertyString( + { dateCp: undefined } as unknown as ExtensionDataProps, + MOCK_GLOSSARY_TERM_CUSTOM_PROPERTIES + ); + + expect(convertedCSVEntities).toStrictEqual(`dateCp:undefined`); + }); }); }); diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/CSV/CSV.utils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/CSV/CSV.utils.tsx index eecb1291978..c6f23d1d198 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/CSV/CSV.utils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/CSV/CSV.utils.tsx @@ -11,7 +11,14 @@ * limitations under the License. */ import { TypeColumn } from '@inovua/reactdatagrid-community/types'; -import { compact, get, isEmpty, isUndefined, startCase } from 'lodash'; +import { + compact, + get, + isEmpty, + isString, + isUndefined, + startCase, +} from 'lodash'; import React from 'react'; import { ReactComponent as SuccessBadgeIcon } from '../..//assets/svg/success-badge.svg'; import { ReactComponent as FailBadgeIcon } from '../../assets/svg/fail-badge.svg'; @@ -392,12 +399,13 @@ export const convertEntityExtensionToCustomPropertyString = ( convertCustomPropertyValueExtensionToStringBasedOnType( value, customPropertiesMapByName[key] - ) as string; + ); const endValue = isLastElement ? '' : ';'; const hasSeparator = - stringValue.includes(',') || stringValue.includes(';'); + isString(stringValue) && + (stringValue.includes(',') || stringValue.includes(';')); // Check if the property type is markdown or sqlQuery or string and add quotes around the value if (