payloadcms / payload

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.
https://payloadcms.com
MIT License
28.17k stars 1.75k forks source link

`id` is not URI decoded before lookup #9373

Closed nathanclevenger closed 4 days ago

nathanclevenger commented 5 days ago

Describe the Bug

In a collection with a id of type text, the id is not URI decoded before lookup, so it's impossible to view/edit the item as attempts to navigate result in a 404

Link to the code that reproduces this issue

https://github.com/nathanclevenger/payload-repro

Reproduction Steps

Create a document with an ID that would be URL Encoded (space/symbol/emoji,etc) Image

On save, it redirects to a 404: Image

In the collection, all items are displayed, but links are invalid: Image Image

Which area(s) are affected? (Select all that apply)

area: ui

Environment Info

Payload: 3.0.1
Nextjs: 15.0.0
Node: 20.13.1
JarrodMFlesch commented 5 days ago

Currently Payload does not allow for custom IDs that look like this. You will need to run sanitization on the ID's before the document gets created.

nathanclevenger commented 4 days ago

@JarrodMFlesch I just confirmed that this syntax in id works fine in Payload 2.0, that we are running into as we are upgrading our production systems from Payload 2 to Payload 3.

Since this is a regression with Payload 3.0, and is a show stopper for our upgrade as many documents are no longer accessible after the upgrade, and simply return 404 when it worked fine in Payload 2.0, will you reconsider and re-open this issue?

JarrodMFlesch commented 4 days ago

PR to fix this regression.

github-actions[bot] commented 3 days ago

🚀 This is included in version v3.1.0

github-actions[bot] commented 1 day ago

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.