Skip to content

fix: read draft query in me endpoint - #18073

Open
jashkarangiya wants to merge 1 commit into
payloadcms:mainfrom
jashkarangiya:fix/me-draft-search-param
Open

jashkarangiya wants to merge 1 commit into
payloadcms:mainfrom
jashkarangiya:fix/me-draft-search-param

Conversation

@jashkarangiya

Copy link
Copy Markdown

What?

  • Corrects the authenticated me endpoint's URL search-parameter fallback for draft
  • Adds a unit regression test covering requests where draft is present in URLSearchParams but not req.query

Why?

The handler initialized draftFromSearchParams with searchParams.get('depth'). Adapters that rely on the standard search-parameter representation therefore passed draft: false to meOperation for ?draft=true.

How?

The fallback now reads searchParams.get('draft'). The regression test invokes the handler with new URLSearchParams('draft=true') and verifies that meOperation receives draft: true.

Validation:

  • Focused regression test passed
  • Full unit suite passed: 214 files, 2,259 tests (4 skipped)
  • Payload package and translation dependency build passed through pnpm build:payload
  • ESLint, Prettier, and git diff --check passed for the changed files

The same typo is present on 3.x; this PR targets main per the repository's v4 development guidance and can be backported separately.

Fixes #18072

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Authenticated me endpoint ignores the draft URL search parameter

1 participant