-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Description
Bug report
Describe the bug
When creating a translation of an entity and directly publishing it we get an error that complains about the related entity not existing or the entity already existing the locale.
Warning:
The related entity doesn't exist or the entity already exists in this locale
Possibly related to this recent fix in Strapi 4.20.1?
#19510
Steps to reproduce the behavior
- Have 2 localizations set up
- Create an entity
- Create a translation for the entity
- Save the translated entity
- Publish the translated entity
Expected behavior
The entity is published
Additional context
When creating a translation you end up on an URL like this:
http://localhost:1337/admin/content-manager/collection-types/api::page.page/create?plugins[i18n][locale]=sv&plugins[i18n][relatedEntityId]=4
When the new entity is saved you end up on an URL like this:
http://localhost:1337/admin/content-manager/collection-types/api::page.page/21?plugins[i18n][locale]=sv&plugins[i18n][relatedEntityId]=4
Publishing the entity from that URL generates an error (as describe above).
If you remove the relatedEntityId part of the URL (&plugins[i18n][relatedEntityId]=4) and trying to publish it does not give an error and the entity gets published.
There seems to be a validation check when publishing the entity that throws an error. Either this check should not be done when publishing the entity, or once you save the entity the relatedEntityId part should be removed from the URL.