Skip to content

fix: validate collection and global slug uniqueness in sanitizeConfig - #18596

Open
PINYOPATTANAWASANPORN wants to merge 1 commit into
payloadcms:mainfrom
PINYOPATTANAWASANPORN:fix/validate-global-collection-slug-uniqueness-18584
Open

PINYOPATTANAWASANPORN wants to merge 1 commit into
payloadcms:mainfrom
PINYOPATTANAWASANPORN:fix/validate-global-collection-slug-uniqueness-18584

Conversation

@PINYOPATTANAWASANPORN

Copy link
Copy Markdown
Contributor

Summary of Changes

  • Enforces slug uniqueness across collections and globals as well as between multiple globals during sanitizeConfig (Collection and global slugs are not validated for uniqueness #18584).
  • Overloads DuplicateGlobal constructor to support property-level duplicate reporting (new DuplicateGlobal('slug', globalSlug)), mirroring DuplicateCollection.
  • Throws early before database adapters or schema caches initialize, preventing database overwrite errors on MongoDB and silent column/data collision on SQLite/SQL adapters.
  • Adds comprehensive unit test coverage in packages/payload/src/config/sanitize.spec.ts.

Closes #18584

…Config (payloadcms#18584)

Enforce slug uniqueness across collections and globals as well as between multiple globals during sanitizeConfig to prevent database schema collision and silent data overwrite.
@PINYOPATTANAWASANPORN PINYOPATTANAWASANPORN changed the title fix(core): validate collection and global slug uniqueness in sanitizeConfig (#18584) fix: validate collection and global slug uniqueness in sanitizeConfig (#18584) Oct 7, 2026
@PINYOPATTANAWASANPORN PINYOPATTANAWASANPORN changed the title fix: validate collection and global slug uniqueness in sanitizeConfig (#18584) fix(core): validate collection and global slug uniqueness in sanitizeConfig (#18584) Oct 7, 2026
@PINYOPATTANAWASANPORN PINYOPATTANAWASANPORN changed the title fix(core): validate collection and global slug uniqueness in sanitizeConfig (#18584) fix: validate collection and global slug uniqueness in sanitizeConfig Oct 7, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collection and global slugs are not validated for uniqueness

1 participant