Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
Non-standard ids caused an issue when finding the document on the server.
This is an odd regression, in 2.0 we were fetching the document on the client so the request would handle decoding the url. Now we are fetching the document on the server and need to do this manually when reading id from route params.
Why?
The slug pulled out of the url for an id of id 1 would equate to id%201 which would fail in the payload.find call since there is not an id stored as id%201 but instead id 1.
How?
Wherever we are calling payload.find in the views and querying by id it gets ran through a helper function that decodes it properly.
What?
Non-standard ids caused an issue when finding the document on the server.
This is an odd regression, in 2.0 we were fetching the document on the client so the request would handle decoding the url. Now we are fetching the document on the server and need to do this manually when reading id from route params.
Why?
The slug pulled out of the url for an id of
id 1
would equate toid%201
which would fail in thepayload.find
call since there is not an id stored asid%201
but insteadid 1
.How?
Wherever we are calling payload.find in the views and querying by
id
it gets ran through a helper function that decodes it properly.Fixes #9373