-
Notifications
You must be signed in to change notification settings - Fork 8
[CMG-769] #858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CMG-769] #858
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,7 +41,7 @@ const handleFileProcessing = async ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| file_details: config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (fileExt === 'xml') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (fileExt === 'xml' && (cmsType === 'wordpress' || cmsType === 'drupal')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (await validator({ data: zipBuffer, type: cmsType, extension: fileExt })) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+44
to
45
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (fileExt === 'xml' && (cmsType === 'wordpress' || cmsType === 'drupal')) { | |
| if (await validator({ data: zipBuffer, type: cmsType, extension: fileExt })) { | |
| } else if (fileExt === 'xml' && cmsType === 'aem') { | |
| // For AEM XML files, skip validation and accept the file | |
| const $ = Cheerio.load(zipBuffer, { xmlMode: true }); | |
| const fixedXml = $.xml(); | |
| const parsedJson = await parseXmlToJson(fixedXml); | |
| const isSaved = await saveJson(parsedJson, `${name}.json`); | |
| if (isSaved) { | |
| logger.info('AEM XML file accepted without validation:', { | |
| status: HTTP_CODES?.OK, | |
| message: HTTP_TEXTS?.VALIDATION_SUCCESSFULL | |
| }); | |
| return { | |
| status: HTTP_CODES?.OK, | |
| message: HTTP_TEXTS?.VALIDATION_SUCCESSFULL, | |
| file_details: config | |
| }; | |
| } else { | |
| logger.warn('AEM XML file save error:', { | |
| status: HTTP_CODES?.UNAUTHORIZED, | |
| message: HTTP_TEXTS?.VALIDATION_ERROR | |
| }); | |
| return { | |
| status: HTTP_CODES?.UNAUTHORIZED, | |
| message: HTTP_TEXTS?.VALIDATION_ERROR, | |
| file_details: config | |
| }; | |
| } | |
| } else if (fileExt === 'xml' && (cmsType === 'wordpress' || cmsType === 'drupal')) { | |
| // For Drupal and WordPress XML files, validate appropriately | |
| let validatorType = cmsType; | |
| if (cmsType === 'drupal' && fileExt === 'xml') { | |
| validatorType = 'drupal-xml'; // Use a specific validator type for Drupal XML | |
| } | |
| if (await validator({ data: zipBuffer, type: validatorType, extension: fileExt })) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent folder/directory handling. The old code checked
fileIcon === 'Folder'for both the value display and icon selection. The new code checksfileIcon === 'DIRECTORY'on line 89, but there's no code that sets fileIcon to 'DIRECTORY'. The fileIcon is set fromselectedFileFormat?.title(lines 70, 73) or extracted from the file extension (line 59), neither of which would produce 'DIRECTORY'. This means the Folder icon will never be shown. Consider changing line 89 to check forfileIcon === 'Folder'instead.