Feature/cmg 705#1059
Open
aishwarya-cstk wants to merge 11 commits intodevfrom
Open
Conversation
- Introduced hasMeaningfulHtmlContent function to determine if HTML contains substantive content. - Added attachCoverBackgroundMediaToChildren and attachMediaTextFieldsToChildren functions for improved media handling in core blocks. - Updated createSchema and schemaMapper functions to accommodate new media-text block processing. - Refined logic in extractItems and updated MIME type handling in getMimeTypeFromExtension for better robustness.
vikrantraut-cstk
previously approved these changes
May 7, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the WordPress migration pipeline to (1) always persist locale mapping before content-type mapping, and (2) improve Gutenberg block handling—especially core/media-text—including richer “meaningful HTML” detection and more robust asset lookup.
Changes:
- Post
/localeMapperbefore/createDummyDatain the upload-api WordPress controller, and update unit tests to reflect the new request order/behavior. - Add WordPress
core/media-textschema mapping + adjust block dedupe/structure logic to avoid merging it incorrectly with other blocks. - Improve WordPress parsing in the API service (meaningful HTML detection, cover/media-text media attachment, asset resolution, and asset file writing path changes) and update README instructions.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| upload-api/tests/unit/controllers/wordpress.controller.test.ts | Updates test expectations for new localeMapper-first request order and “locale always posted” behavior. |
| upload-api/src/controllers/wordpress/index.ts | Sends locale mapper POST before content-type mapper POST. |
| upload-api/migration-wordpress/libs/schemaMapper.ts | Adds a new schema mapping case for core/media-text. |
| upload-api/migration-wordpress/libs/extractItems.ts | Extends cross-block dedupe/structure checks to include media-text vs paragraph. |
| README.md | Adds/adjusts installation and usage instructions for api/upload-api. |
| api/src/utils/wordpressParseUtil.ts | Adds hasMeaningfulHtmlContent() to detect non-text meaningful markup (media/embeds). |
| api/src/utils/mimeTypes.ts | Makes extension lowercasing tolerant to undefined inputs. |
| api/src/services/wordpress.service.ts | Enhances schema creation/formatting for cover + media-text, improves RTE emptiness detection, adjusts asset lookup, and changes asset write/existence logic. |
Comments suppressed due to low confidence (1)
api/src/services/wordpress.service.ts:1826
saveAssetFromUrlnow checksfs.existsSync(assetPath)whereassetPathis the directory (.../files/<customId>), not the actual downloaded file. This can incorrectly short-circuit downloads (e.g., if the directory exists from a previous attempt, or when the samecustomIdis reused with a different extension), returning an asset ID even though the expected file is missing. Check existence against the full file path (directory +filename) and keep the path variables consistent with where the file is written/lstat’d.
const assetPath = path.resolve(assetsSave, "files", customId);
// Check if asset already exists
if (fs.existsSync(assetPath)) {
return customId;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
umesh-more-cstk
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.