fix(content-import): validate Content Type before streaming sample CSV - #37535
Queued
Neehakethi wants to merge 2 commits into
Queued
Neehakethi wants to merge 2 commits into
Neehakethi wants to merge 2 commits into
Conversation
Contributor
|
Claude finished @Neehakethi's task in 52s —— View job Code ReviewReviewed the diff against Verified:
New IssuesNo issues found. Two non-blocking observations (not defects):
Matches the approved review — the reviewer's request to also validate that the selected Content Type exists (not just that |
Neehakethi
requested review from
danielsilva-dotcms,
danielsolis-dotcms,
fabrizzio-dotCMS and
gortiz-dotcms
September 14, 2026 16:41
danielsolis-dotcms
previously approved these changes
Sep 15, 2026
danielsolis-dotcms
approved these changes
Sep 17, 2026
Neehakethi
force-pushed
the
issue-37461-import-content-csv-sample-download
branch
from
September 17, 2026 17:20
e153318 to
a593a0f
Compare
#37461) Clicking "download a CSV sample file" with no Content Type selected threw after the attachment headers were committed, returning an empty 500 the browser rendered as an error page. Guard the action (reusing the preview branch's structure-type-is-required message) and validate client-side before submitting. Refs: #37461
… no longer exists (#37461) Addresses PR review feedback: a set-but-nonexistent structure inode (type deleted after the screen loaded, or a crafted request) made the fields lookup throw to an error page. Catch the lookup failure and re-render the import screen with the existing Content-Type-does-not-exist message. Refs: #37461
Neehakethi
force-pushed
the
issue-37461-import-content-csv-sample-download
branch
from
September 17, 2026 17:27
a593a0f to
bdea283
Compare
Neehakethi
enabled auto-merge
September 17, 2026 17:29
Neehakethi
added this pull request to the merge queue
Sep 17, 2026
Any commits made after this event will not be merged.
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Sep 17, 2026
Neehakethi
added this pull request to the merge queue
Sep 17, 2026
Any commits made after this event will not be merged.
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.
Fixes #37461
Proposed Changes
ImportContentletsAction._downloadCSVTemplateso a missing Content Type re-renders the Import Content screen with the existingstructure-type-is-requiredmessage instead of throwing after the download headers are committed. The field lookup now happens before any header is set, so a failed lookup can no longer leave the response flagged as an attachment with an empty error body.import_contentlets.jsp#downloadCSVExample()and show "A Content Type is required" viashowDotCMSSystemMessage, so the form never submits an emptystructure.Root cause
The link is not dead — it breaks only when no Content Type is selected, which is the screen's default state. In that state the form POSTs
structure=""; the action setContent-Type: application/octet-stream+Content-Disposition: attachmentand opened the output stream first, thenFieldsCache.getFieldsByStructureInode("")→ContentTypeAPI.find("")threw. The result was an HTTP 500 with attachment headers and an empty body, which Chrome renders inside the portlet iframe as "webpage might be temporarily down or it may have moved permanently" — the error page in the issue screenshots. With a Content Type selected the download worked all along (verified ondemo.dotcms.com26.09.03-01: validstructure→ 200 + correct CSV; emptystructure→ 500 + attachment headers + empty body).The fix mirrors the validation the
previewbranch of the sameprocessActionalready applies, reusing its existing i18n key (translations already present).Checklist
ImportContentletsActionhas no existing test coverage and no portlet-action test harness; flagged as a known gap. Verified by reproduction (below).structure-type-is-requiredkey (Language.properties), no new keys.Additional Info
Verified on a local build from this branch (empty starter):
cmd=downloadCSVTemplatewith emptystructure) now returns HTTP 200 re-rendering the portlet, with noContent-Dispositionheader.structure,CSV_Template.csvstill downloads with the correct header row for the selected type.previewvalidation path (whose pattern this reuses) behaves as before.The issue floated reimplementing the download as a REST endpoint (e.g.
GET /v1/content/_import/_template). Deliberately out of scope here — the legacy endpoint works once validated; a REST template endpoint can be a follow-up if wanted.Screenshots
CSV_Template.csvdownloads.Before :
After :
