-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: do not validate locale if not creating #19626
Conversation
Co-authored-by: Josh <37798644+joshuaellis@users.noreply.github.com>
Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed, neither of us like this, but it fixes the problem and there doesn't appear to be a better way 😆
I suspect that even though this will solve 99% of the cases, there will be a handful of edge cases we didn't anticipate that will have to be solved later, but we'll find out then, and it shouldn't actually break anything
This PR did not account for query parameters so url like this |
@minht11 thank you for the report :) Will create a ticket with the fix today |
What does it do?
I18n Backend koa middlweare was matching all CM routes, and validating locale creation even for actions that were not related (publishing, unpublishing)
If the API received the "relatedEntityId" param when publishing, it assumed this was for creating a new locale (and checked if the locale already existed), and failed because the action was to publish an existing locale.
My only worry here is that the url matching is not smart enough and we miss some cases
How to test?
Create single types and collection type locales, and publish them. You should not get an error
Related issues