fix(push-publishing): prevent non-Host contentlets from being bundled as .host.xml - #36941
fix(push-publishing): prevent non-Host contentlets from being bundled as .host.xml#36941gortiz-dotcms wants to merge 4 commits into
Conversation
… as .host.xml (#34522) HostBundler.writeFileToDisk() now skips contentlets whose content type is not Host (e.g. Widgets related via relationship field), preventing them from being written with the .host.xml extension and causing a NotFoundInDbException or NPE on the receiving server. ContentHandler adds a null-safety guard as a secondary line of defense. Refs: #34522 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @gortiz-dotcms's task in 8m 2s —— View job Code ReviewI reviewed the diff against New IssuesNo blocking issues found. Observations (non-blocking)
Notes on correctness
Suggestions
Overall: clean, minimal, and addresses the root cause in the bundler with a reasonable defensive guard in the handler. Good test coverage for the regression. |
) Narrow the !isHost() guard to also allow FileAsset contentlets through writeFileToDisk(), since HostBundler deliberately collects and writes file assets linked via FILE-type fields (line 396 uses isFileAsset to produce an inode-based filename). The previous guard was too broad and silently dropped those file assets. The ContentHandler null-safety check added in the same PR handles the receiver side gracefully for both file assets and non-Host types. Refs: #34522 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…undled as .host.xml (#34522) Adds test_relatedNonHostContentlet_isNotBundledAsHostXml to verify that a Widget related to a Site via a Relationship field is not written as a .host.xml file when the Site is push-published with Only Selected Items. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Use correct APILocator.getContentTypeAPI(User, boolean) signature, switch FileUtil import to com.liferay.util.FileUtil for listFilesRecursively, and use List<File> return type. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
✅ dotCMS Backend Review: no issues found. |
Summary
HostBundler.writeFileToDisk()now skips any contentlet whose content type is not a Host (e.g. Widgets or regular content related to a Site via relationship field), preventing them from being incorrectly written with the.host.xmlextensionContentHandleradds a null-safety guard aroundhostAPI.find()as a secondary line of defense — logs a warning and skips host-only update steps instead of NPE-ingHostBundler.getRelatedFilesAndContent()callsfindContentRelationships()and pulls ALL related contentlets unconditionally; those were then written as.host.xmlfiles regardless of their actual content type, causing either aNotFoundInDbException(ContentType not on receiver) or NPE (hostis null) when the receiver processed themTest plan
NotFoundInDbExceptionor NPE./mvnw verify -pl :dotcms-integration -Dcoreit.test.skip=false -Dit.test=ContentHandlerTestFixes #34522
🤖 Generated with Claude Code