Skip to content

Issue directly publishing a translated entity after translating #19528

@iwap

Description

@iwap

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

  1. Have 2 localizations set up
  2. Create an entity
  3. Create a translation for the entity
  4. Save the translated entity
  5. 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.

Metadata

Metadata

Labels

issue: bugIssue reporting a bugseverity: highIf it breaks the basic use of the productsource: plugin:i18nSource is plugin/i18n packagestatus: confirmedConfirmed by a Strapi Team member or multiple community members

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions