Conversation
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds configurable limits for import and export operations to prevent excessive server resource usage, and fixes several bugs related to timezone handling, CSV export formatting, and configuration application. The limits can be set globally or per-collection and support dynamic functions based on request context.
Changes:
- Added
exportLimitandimportLimitconfiguration options (global and per-collection) - Fixed timezone companion fields being incorrectly included in exports
- Fixed
formatanddisableSavesettings not being applied to collection export configurations - Expanded test coverage for additional field types (checkbox, select, radio, email, textarea, code, point)
Reviewed changes
Copilot reviewed 85 out of 87 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/plugin-import-export/shared.ts | Added new collection slugs for testing limits and media uploads |
| test/plugin-import-export/seed/index.ts | Added seed data for new field types and media collection |
| test/plugin-import-export/payload-types.ts | Updated TypeScript types to include new collections, fields, and limit configurations |
| test/plugin-import-export/e2e.spec.ts | Added E2E tests for format enforcement, preview pagination, and limit enforcement |
| test/plugin-import-export/config.ts | Added configuration for timezone support and collections with limits |
| test/plugin-import-export/collections/PostsWithLimits.ts | Created new collection for testing limit enforcement |
| test/plugin-import-export/collections/Pages.ts | Added new field types for comprehensive testing |
| test/plugin-import-export/collections/Media.ts | Created media collection for upload field testing |
| packages/plugin-import-export/src/utilities/unflattenObject.ts | Improved code clarity with better variable naming and documentation |
| packages/plugin-import-export/src/utilities/resolveLimit.ts | New utility to resolve limit values (numbers or functions) |
| packages/plugin-import-export/src/utilities/parseCSV.ts | Improved comment clarity for CSV parsing logic |
| packages/plugin-import-export/src/utilities/getvalueAtPath.ts | Removed internal utility in favor of shared Payload function |
| packages/plugin-import-export/src/utilities/getSchemaColumns.ts | Added timezone companion field filtering and improved column ordering logic |
| packages/plugin-import-export/src/utilities/getPluginCollections.ts | Fixed application of non-override collection settings to base collection |
| packages/plugin-import-export/src/utilities/getImportFieldFunctions.ts | Cleaned up comments for better code clarity |
| packages/plugin-import-export/src/utilities/getExportFieldFunctions.ts | Added special handling for date fields to prevent incorrect timezone field inclusion |
| packages/plugin-import-export/src/utilities/flattenObject.ts | Added timezone field filtering and optimized field selection logic |
| packages/plugin-import-export/src/utilities/fieldToRegex.ts | New utility to create regex patterns for field path matching |
| packages/plugin-import-export/src/utilities/fieldToRegex.spec.ts | Comprehensive tests for field path regex generation |
| packages/plugin-import-export/src/utilities/collectTimezoneCompanionFields.ts | New utility to identify auto-generated timezone companion fields |
| packages/plugin-import-export/src/utilities/collectTimezoneCompanionFields.spec.ts | Tests for timezone companion field collection |
| packages/plugin-import-export/src/utilities/buildDisabledFieldRegex.ts | Rewritten to properly handle field names with underscores and block slugs |
| packages/plugin-import-export/src/utilities/buildDisabledFieldRegex.spec.ts | Tests for disabled field regex generation |
| packages/plugin-import-export/src/types.ts | Added Limit and LimitFunction types for configurable limits |
| packages/plugin-import-export/src/translations/languages/*.ts | Added translations for limit-related messages in all supported languages |
| packages/plugin-import-export/src/index.ts | Added limit configuration storage in collection custom properties |
| packages/plugin-import-export/src/import/handlePreview.ts | Added max limit resolution and enforcement in preview |
| packages/plugin-import-export/src/import/getImportCollection.ts | Added limit resolution for synchronous and job-based imports |
| packages/plugin-import-export/src/import/getCreateImportCollectionTask.ts | Added maxLimit field to import task definition |
| packages/plugin-import-export/src/import/createImport.ts | Added limit enforcement before processing import documents |
| packages/plugin-import-export/src/import/batchProcessor.ts | Improved variable naming and documentation for batch import processing |
| packages/plugin-import-export/src/exports/types.ts | Exported Limit types for external use |
| packages/plugin-import-export/src/export/handlePreview.ts | Added limit enforcement in export preview with timezone field filtering |
| packages/plugin-import-export/src/export/handleDownload.ts | Added format validation and limit resolution for downloads |
| packages/plugin-import-export/src/export/getFields.ts | Changed format field to read-only when forced format is configured |
| packages/plugin-import-export/src/export/getExportCollection.ts | Added limit resolution for synchronous and job-based exports |
| packages/plugin-import-export/src/export/getCreateExportCollectionTask.ts | Added maxLimit field to export task definition |
| packages/plugin-import-export/src/export/createExport.ts | Added limit enforcement logic with timezone field filtering and BOM for CSV |
| packages/plugin-import-export/src/components/ImportPreview/index.tsx | Replaced internal utility with shared Payload function |
| packages/plugin-import-export/src/components/ExportPreview/index.tsx | Added UI display for limit warnings when user limit exceeds max |
| packages/plugin-import-export/src/components/ExportPreview/index.scss | Added styling for limit warning message |
| docs/plugins/import-export.mdx | Added documentation for limit configuration and usage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PatrikKozak
requested changes
Feb 3, 2026
packages/plugin-import-export/src/export/getExportCollection.ts
Outdated
Show resolved
Hide resolved
packages/plugin-import-export/src/export/getExportCollection.ts
Outdated
Show resolved
Hide resolved
PatrikKozak
approved these changes
Feb 5, 2026
paulpopus
added a commit
that referenced
this pull request
Feb 6, 2026
…d in a storage adapter such as S3 (#15441) Relies on #15405 first When using a storage adapter such as S3 to handle files there were errors in the way the files would be fetched for imports. This PR fixes that, adding test coverage and changes the job behaviour so that it only stores the import doc ID and not the full file data - this avoids many problems down the line and optimises memory and storage usage. Fixes #15247 Previously attempting to use an import with the jobs queue with S3 storage would result in this error: ```text [11:46:25] ERROR: Failed to queue import job for document 698628f19aaca7d4f4f18c6e err: { "type": "Error", "message": "ENOENT: no such file or directory, open '/posts-with-s3-import/2026-02-06 114542.csv'", "stack": Error: ENOENT: no such file or directory, open '/posts-with-s3-import/2026-02-06 114542.csv' ``` Also: - Exports `getExternalFile` utility from `payload/internals`
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.
This PR adds
exportLimit,importLimitand per collectionlimitcontrol and fixes a few reported bugs around preview behaviour and data exports to CSV and expands the test coverage to all fields except uploads as those will be expanded upon in another PR. Some of these bugs are reported directly, not on Github.New limits control
Adds new exportLimit, importLimit and per collection limit control so you can force a limit per user if necessary for how many documents can be exported or imported in a single operation. This allows you to prevent certain users from causing excessive server/resource usage.
The config can be added top level to affect all operations or you can override on a per collection and per operation level, defaults to 0 (unlimited).
Bugs fixed:
disableSaveandformathaving no effect on the collection's export configurationChores:
payload/sharedoneformatpoint,checkbox,select,radio,email,textareaandcode