diff --git a/ui/src/components/ContentMapper/index.tsx b/ui/src/components/ContentMapper/index.tsx index cac3a6d7c..31c999690 100644 --- a/ui/src/components/ContentMapper/index.tsx +++ b/ui/src/components/ContentMapper/index.tsx @@ -888,7 +888,6 @@ const ContentMapper = forwardRef(({projectData}: ContentMapperComponentProps, re if (checkConditions(fieldTypeToMatch, key, item)) { OptionsForRow.push(getMatchingOption(key, true, `${updatedDisplayName} > ${key.display_name}` || '')); - break; } // Recursively process nested groups diff --git a/ui/src/services/api/upload.service.ts b/ui/src/services/api/upload.service.ts index 2c56606e3..3f447022b 100644 --- a/ui/src/services/api/upload.service.ts +++ b/ui/src/services/api/upload.service.ts @@ -8,12 +8,8 @@ export const getCall = async (url: string, options?: any) => { try { const response = await axios.get(url, { ...options }); return response; - } catch (error) { - if (error instanceof Error) { - throw new Error(`${error.message}`); - } else { - throw new Error('Unknown error in userSession'); - } + } catch (err: any) { + return err.response; } }; @@ -44,7 +40,7 @@ export const uploadFilePath = () => { return `${UPLOAD_FILE_RELATIVE_URL}upload`; }; -export const fileValidation = (projectId: string) => { +export const fileValidation = async(projectId: string) => { try { const options = { headers: { @@ -53,16 +49,13 @@ export const fileValidation = (projectId: string) => { }, }; - return getCall(`${UPLOAD_FILE_RELATIVE_URL}validator`, options); + return await getCall(`${UPLOAD_FILE_RELATIVE_URL}validator`, options); } catch (error) { - if (error instanceof Error) { - throw new Error(`${error.message}`); - } else { - throw new Error('Unknown error'); - } + return error; } }; + export const getConfig = async() => { try { return await getCall(`${UPLOAD_FILE_RELATIVE_URL}config`); diff --git a/uplaode-api/src/services/fileProcessing.ts b/uplaode-api/src/services/fileProcessing.ts index 5df0fe6bf..4a92b700b 100644 --- a/uplaode-api/src/services/fileProcessing.ts +++ b/uplaode-api/src/services/fileProcessing.ts @@ -10,7 +10,7 @@ const handleFileProcessing = async (fileExt: string, zipBuffer: any, cmsType: st if (fileExt === 'zip') { const zip = new JSZip(); await zip.loadAsync(zipBuffer); - if (validator({ data: zip, type: cmsType, extension: fileExt })) { + if (await validator({ data: zip, type: cmsType, extension: fileExt })) { const isSaved = await saveZip(zip); if (isSaved) { logger.info('Validation success:', { @@ -38,7 +38,7 @@ const handleFileProcessing = async (fileExt: string, zipBuffer: any, cmsType: st // if file is not zip // Convert the buffer to a string assuming it's UTF-8 encoded const jsonString = Buffer?.from?.(zipBuffer)?.toString?.('utf8'); - if (validator({ data: jsonString, type: cmsType, extension: fileExt })) { + if (await validator({ data: jsonString, type: cmsType, extension: fileExt })) { logger.info('Validation success:', { status: HTTP_CODES?.OK, message: HTTP_TEXTS?.VALIDATION_SUCCESSFULL,