fix: unable to load documents with non-standard ids #9407
Merged
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.
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