Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ui/src/components/ContentMapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 6 additions & 13 deletions ui/src/services/api/upload.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};

Expand Down Expand Up @@ -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: {
Expand All @@ -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`);
Expand Down
4 changes: 2 additions & 2 deletions uplaode-api/src/services/fileProcessing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:', {
Expand Down Expand Up @@ -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,
Expand Down