Repository navigation
Description
Description
Content Drive has no way to export content. Today the only CSV export is in the legacy Content Search portlet: it exports every result of the current filters (site or folder, language, workflow, text, System Host) for exactly one content type, without paging, and silently stops at 100,000 rows.
This task brings that export to Content Drive through a new endpoint (POST /api/v1/drive/export), reusing the Content Search CSV logic (same columns, values and file name), so every CSV can be imported back. It has two modes, delivered in this order:
- Filter mode — feature parity with Content Search. With nothing selected and the listing filtered to exactly one content type, Export downloads one CSV with every contentlet the listing shows for the current location and filters, across all pages. The location works as Content Search's filters do: All Site Content covers the whole site, and a folder covers only what sits directly in it.
- Selection mode — new. The user selects up to 60 items (folders and contentlets, of any content types). A contentlet selected on its own is exported only in the language version that was selected. A selected folder brings every contentlet below it, at any depth, in every language version and including archived ones; folders themselves are never rows. The result is a zip with one CSV per content type. Drive's filters do not apply: what you select is what you export.
Rules for both modes
- If there is a selection, the selection wins over the filter.
- Only content the user can read is exported, and nothing tells the user how much was skipped.
- At most 100,000 rows. A bigger export is refused with a clear message instead of being truncated.
- Forms and Host content are never exported. Files and pages are content and get their own CSVs.
- File names follow Content Search: each CSV is
<ContentType>_contents_<M_d_yyyy>.csv, and the zip is<SiteName>_export_<M_d_yyyy>.zip. - The CSV format is the legacy one, with one change: the host/folder column is written as a readable location instead of an identifier (see Spec review adjustments for its three forms).
- The Content Search export itself does not change.
UI: the Export button lives in the Drive toolbar, not in the Action Center. With nothing selected it appears when the listing is filtered to one content type, and it is disabled when the listing shows no contentlets. With a selection it appears beside the workflow actions, and it is disabled above 60 items. It shows a loading state while running, and a toast with the result.
Out of scope: filter mode with more than one content type, exporting across all sites at once, recursive filter mode inside a folder (select the folder instead), import (#37896), background-job exports, and exporting file contents (binary fields export as a download URL, as in legacy).
Acceptance Criteria
Filter mode (parity)
- With nothing selected and the listing filtered to exactly one content type (not a Form), the Export button appears in every Drive view; with no type or more than one, it does not
- When the listing shows no contentlets for the current filters, the Export button is disabled
- The CSV holds exactly the contentlets the listing shows for that type and the active filters (language, workflow, status, text, Include System Host), across every page
- In All Site Content the whole site is exported; inside a folder, only the contentlets directly in it
- A single CSV named
<ContentType>_contents_<M_d_yyyy>.csvdownloads, not a zip - For the same type and filters, the Drive CSV matches the Content Search CSV, except the host/folder column
Selection mode
- With items selected, the Export button appears beside the workflow actions; the Action Center has no Export row
- With more than 60 items selected, the Export button is disabled and explains the limit; the endpoint rejects more than 60 entries with
400 - A selected folder exports the contentlets in it and in all its subfolders at any depth; no folder is a row
- Folders and contentlets of different types export together as one zip
<SiteName>_export_<M_d_yyyy>.zip, with one CSV per content type and one header row each - Each contentlet version appears once, even when selected directly and inside a selected folder, or when nested folders are both selected
- A contentlet selected on its own is exported only in the selected language version; its other language versions are exported only if they were selected too
- A selected folder exports every language version and the archived contentlets below it, one row per version
- Drive's filters do not change what a selection exports
- With a selection and a single-type filter at the same time, the selection is exported
Both modes
- Forms and Host content are never exported
- From 1 to 100,000 rows, every row is exported, including exports of more than 10,000 rows; above 100,000 readable rows the export is refused with
400and a message saying it has more than 100,000 rows and that 100,000 is the limit - A selection with nothing the user can read (for example a readable folder whose content is not readable) returns
204and the toast says there is nothing to export; a refusal or failure shows the server's message; no file downloads in either case - While running, the button shows a loading state and cannot be clicked again; on success the toast reports the items and files exported
- A successful response carries
X-Export-Contentlets,X-Export-FilesandContent-Length, and no temp file is left on the server, whether the export succeeded or failed - A CSV from either mode can be imported back (key field Identifier, no language) with no row errors, and every contentlet stays on the same site and in the same folder
- The Content Search export keeps its current behavior
Permissions
- A contentlet the user cannot read is never exported
- Content in a subfolder the user cannot read is not exported, at any depth below it
- A selected contentlet the user can read is exported even if its folder is not readable
- Selecting a folder the user cannot read returns
404(see Spec review adjustments) - Integration tests cover these cases with a limited user in both modes, registered in a MainSuite; the endpoint is documented and
openapi.yamlis regenerated
Spec review adjustments
Added after the spec review on the spec PR (#38043):
- Working version only. Every row is the working version of its contentlet in its language, in both modes, as Content Search exports it. A published contentlet edited afterwards has a live and a working version in the same language; only the working one is exported, so the file never holds two rows with the same Identifier and language.
- Filter mode reads a complete result. It must get the full set of readable results for the same query the Drive listing uses, through an operation that guarantees completeness. It must not walk the listing's screen pages: past the database scan budget (
BROWSER_DB_MAX_SCAN_ROWS, 50,000 by default) those pages come back short while still reporting more results, so rows could be dropped silently. - The content type is validated after it is resolved. The listing drops a content type that does not exist or that the user cannot read, and with no type left it returns every type. Filter mode rejects both cases with the same
400and never falls through to an export without a type restriction. - Permissions that change mid-export. A contentlet that stops being readable after it was counted is skipped instead of failing the export, and the reported row count is the number of rows actually written.
- Folder existence is not revealed. An unreadable folder and a folder that does not exist get the same
404. - Refusing a large export stays cheap. The over-limit message says the export has more than 100,000 rows instead of giving the exact total, so counting can stop at 100,001 rather than resolving and permission-checking millions of contentlets just to reject them.
- The shared CSV writer sends no websocket messages.
downloadToExcelpushes the "A total of N…" and error messages itself today; when it is extracted, those move to its caller, so Content Search keeps them and Drive does not. - The host/folder column keeps root content on its site. Written as
//site/, content at a site root would be moved to System Host on re-import, because the import resolves the path/to the system folder, and no row error would show it. The column uses the form the existing import already resolves for each case://site/path/for content in a folder, the bare hostname (e.g.demo.dotcms.com) for content at a site root, andSYSTEM_HOSTfor System Host content. It is deliberately not uniform. The import is not changed. - The shared CSV writer stops swallowing failures. Besides sending no websocket messages, the writer moved out of
downloadToExcelpropagates whole-file failures instead of catching them and reporting success, writes to a given output instead of the HTTP response, skips rows that are no longer readable, and reports how many rows it wrote. A failure formatting a single field still leaves that cell empty, as today. - Selections stay within the browsed site. The request names the site being browsed. Folders must belong to it, and contentlets to it or to System Host; anything else gets the same
404.
Acceptance Criteria
- Only the working version is exported, with at most one row per identifier and language, in both modes; a contentlet published and then edited exports one row with the edited values
- Filter mode exports every readable result of the listing's query, including listings whose database scan goes past 50,000 rows and searches with a text filter
- A filter-mode request naming a content type that does not exist, or one the user cannot read, returns the same
400, and no other content type is exported - A contentlet that becomes unreadable during the export is skipped, the export succeeds, and
X-Export-Contentletsmatches the rows written - An unreadable folder and a missing folder return the same
404and message - A folder from another site, or a contentlet outside the browsed site and System Host, returns that same
404 - Rejecting an export far above 100,000 rows does not resolve the whole set; the message says "more than 100,000"
- A Drive export pushes no websocket system messages, and the Content Search export still pushes the ones it pushes today
- The host/folder column is
//site/path/for content in a folder, the bare hostname for content at a site root, andSYSTEM_HOSTfor System Host content - Re-importing content from a folder, from a site root and from System Host leaves each contentlet on the same site and in the same folder
- A failure of the whole file returns
500and no file, never a truncated file or a success message
Priority
Medium
Additional Context
- Import ticket: Content Drive: Add CSV content import #37896
- Legacy export:
EditContentletAction(cmd=export,downloadToExcel); legacy filters inContentletAjaxandview_contentlets_js_inc.jsp - Drive listing search:
ContentDriveResource(/v1/drive/search),ContentDriveHelper.skipsFolderConstraint(a folder is never recursive in the listing) - Recursive folder walk:
FolderAPIImpl.findSubFoldersRecursively; scroll reads:ContentletAPI.createScrollQuery - Frontend precedents:
DotPublishingQueueService.generateBundle(blob download),getDownloadLinkin@dotcms/utils,toFolderAssetPathsin the Driveutils/action-center.ts - Not yet reproduced with a limited user: a readable contentlet inside an unreadable folder being exported when selected directly. It comes from reading the code, which is why it is in the criteria.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsIn Review
Activity
[-]Add content export to Content Drive[/-][+]Content Drive: Add content export[/+]github-actions commentedon Oct 14, 2026
PRs linked to this issue
spec(content-drive): replace the stale input notes with the agreed ex…
spec(content-drive): export only the selected language, empty listing…
spec(content-drive): address the spec review on export versions, comp…
spec(content-drive): stop counting past the export limit and keep the…
spec(content-drive): keep root content on its site on re-import and h…
9 remaining items
feat(content-drive): show why an export produced no file
test(content-drive): cover the export row limit
feat(content-drive): never reveal unreadable content in an export
test(content-drive): prove an exported CSV imports back in place
test(content-drive): cover exporting selected contentlets as a zip
feat(content-drive): export selected contentlets of several types
test(content-drive): cover exporting whole folders
feat(content-drive): export whole folders
test(content-drive): prove selection-mode exports keep every guarantee
fix(content-drive): compile the export form on a clean build
refactor(content-drive): close the Content Search writer and document…
test(content-drive): cover the export gaps found by convergence
fix(content-drive): close the export gaps found by convergence
test(content-drive): stop the selection e2e waiting on hidden workflo…
docs(spec): content drive export changes after the manual check