Skip to content

CMS Page saving fails with "The value specified in the URL Key field would generate a URL that already exists." #31007

@frostblogNet

Description

@frostblogNet

Preconditions (*)

  1. 2.3.6
  2. 2.4.1

Note: 2.4.0 is not affected.

Steps to reproduce (*)

  1. Create a magento installation with 2 storeview (f.e. uk, us)
  2. Go to Stores -> Configuration -> General -> Web and set "Add Store Code to URls" to Yes
  3. Go to Content -> Pages and Create a CMS Page with the identifier "privacy" in the scope of the uk storeview.
  4. Now create a CMS Page with the identifier "privacy" in the scope of the us storeview.

Expected result (*)

  1. saving both cms page with the same identifier is possible due to the fact that the url is still uniqe
    https://example/uk/privacy vs. https://example/us/privacy

Actual result (*)

  1. it is not possible to save the secound cms page.
  2. You will see this error in the backend "The value specified in the URL Key field would generate a URL that already exists."

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

The problem here is a new validator in https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Cms/Model/PageRepository.php#L193. This validator is only checking if there is a CMS Page with the same identifier in the hole frontend scope not the scope itself. This works in a single store / storeview shop but not in a multi store / languarge store.

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Cms/Model/PageRepository.php#L308

Metadata

Metadata

Assignees

Labels

not-confirmedUse for Issue that was closed during confirmation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions