Skip to content
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

CMS Page with identifier shipping cannot save. The value specified in the URL Key field would generate a URL that already exists #35115

Open
4 tasks
aliomattux opened this issue Feb 17, 2022 · 21 comments
Assignees
Labels
Area: Content Component: Cms Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: dev in progress Reported on 2.4.3-p1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@aliomattux
Copy link

aliomattux commented Feb 17, 2022

Preconditions (*)

  1. 2.4.3-p1

Steps to reproduce (*)

  1. Go to Content > Pages
  2. Edit an existing CMS page with identifier shipping or create a new CMS page with identifier shipping
  3. Press Save

Expected result (*)

  1. The CMS page is saved without error.

Actual result (*)

  1. Error message is thrown preventing saving. 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.
  • [X ] 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”.

Description
This bug report is linked to bug: #31007 but is not the same issue.

It is easy to respond and say that Magento core has a frontName value of shipping and therefore, you cannot use ever the url key shipping.

In a rebuttal to such a general statement, shipping is one of the most popular and widely used urls. It is a url used by companies to explain shipping polciies. Several major websites worldwide use this url, and Magento is saying, you cannot use it.

This new validator did not exist in previous versions of Magento 2. In our case we have had since 2008 a url for /shipping. Now Magento decides to not allow it, that doesn't work. We are forced to override "woraround" the validator to update content to a page that cannot just be changed because Magento needs it.

@m2-assistant
Copy link

m2-assistant bot commented Feb 17, 2022

Hi @aliomattux. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-assistant
Copy link

m2-assistant bot commented Feb 17, 2022

Hi @engcom-Hotel. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Hotel
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @engcom-Hotel. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Hotel
Copy link
Contributor

Hello @aliomattux,

Thanks for posting the issue!

We have tried to reproduce the issue in the fresh installed Magento 2.4-develop branch. But for us, the issue is not reproducible. We are able to save the CMS block successfully. Please have a look at the below screenshot for reference:

image

Let us know if we have missed anything.

Thanks

@schnere
Copy link

schnere commented Feb 24, 2022

In my case I have to problem when I create a CMS page with URL key "newsletter". If I change the URL key to newsletter1 it works fine.

@chardwick99
Copy link

chardwick99 commented Mar 1, 2022

@engcom-Hotel, I am having the issue with a CMS Page, with any duplicate URL for two different store's CMS Pages. This should not happen.

Preconditions
2.3.7p-2, MultiStore enabled

Steps to reproduce
Go to Content > Pages
Create two CMS pages with different store views, and identical URL identifiers (e.g. "home")
Press Save

Expected result
The CMS page is saved without error.

Actual result
Error message is thrown preventing saving. "Could not save the page: URL key for specified store already exists."

@m2-assistant
Copy link

m2-assistant bot commented Mar 3, 2022

Hi @engcom-November. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-November
Copy link
Contributor

Verified the issue on Magento 2.4-develop branch and the issue is reproducible:
Admin - Content - Pages - Add New page or Edit existing page with URL key: shipping and Save
image

@engcom-November engcom-November added Area: Content Component: Cms Reported on 2.4.3-p1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Mar 3, 2022
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board Mar 3, 2022
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.magento.com/browse/AC-2554 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Mar 3, 2022

✅ Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@sdzhepa sdzhepa added the Priority: P3 May be fixed according to the position in the backlog. label Mar 10, 2022
@m2-community-project m2-community-project bot added this to Ready for Development in Low Priority Backlog Mar 10, 2022
@pranav7870
Copy link

@magento I am working on this

@pranav7870
Copy link

pranav7870 commented Mar 14, 2022

Hello @aliomattux i've try to reproduce issue in magento 2.4.3-p1. If you have cms page with url key like "shipping, cart, checkout" you will not be able to save it after migration because the validator of url key will find that there is frontend route "shipping, cart, checkout" defined from modules.
if you want to remove this validator then remove line from

diff --git a/vendor/magento/module-cms/Model/PageRepository.php b/vendor/magento/module-cms/Model/PageRepository.php
index e0f50bd..8881534 100644
--- a/vendor/magento/module-cms/Model/PageRepository.php
+++ b/vendor/magento/module-cms/Model/PageRepository.php
@@ -168,7 +168,7 @@ class PageRepository implements PageRepositoryInterface

}
try {
$this->validateLayoutUpdate($page);

   //$this->validateRoutesDuplication($page);
   $this->resource->save($page);
   $this->identityMap->add($page);
} catch (\Exception $exception) {

please check this and let me know if any issues.
Thanks

@chardwick99
Copy link

@pranav7870 Will this fix also fix the problem for ANY url key, not just "shipping, cart, checkout"? @engcom-November verified this as a bug further upthread. This happens when any CMS Page's url key matches another. (e.g "home", "distributors", "XYZ", etc.

@pranav7870
Copy link

@pranav7870 Will this fix also fix the problem for ANY url key, not just "shipping, cart, checkout"? @engcom-November verified this as a bug further upthread. This happens when any CMS Page's url key matches another. (e.g "home", "distributors", "XYZ", etc.

Hello @chardwick99 i've fix this for all urls please check with my code, please check and let me know.
Thanks

@aliomattux
Copy link
Author

@pranav7870 I already know about the proposed "fix". This fix requires me to modify the core code. I reported this as a bug because of the industry standard use of the url key "shipping". As stated in my initial post, many popular ecommerce websites use the url. Additionally, Magento 2 has been operational for years and many ecommerce stores already make use of the url key shipping. Creating the requirement for customers to change the url IMO is a bug introduced. I do not expect it to be changed, but it should be. Therefore, I reject the proposal customers should have to modify their installation to bypass the issue.

@bartoszkubicki
Copy link

bartoszkubicki commented Mar 17, 2022

I have the same issue with route "klarna". After longer consideration that mechanism is not entirely bad, but should more accurate, for example these routes reserved by modules, are not fully occupied, for example 'klarna/index/index' is up for grabs.

@plastikschnitzer
Copy link

If certain page identifiers should be "reserved", their error message should be adapted and not direct in a direction of page identifier duplicates – which is also correct in some way but it won't help you finding the duplicate in your cms pages.

@m2-community-project m2-community-project bot moved this from Dev In Progress to Ready for Development in Low Priority Backlog Apr 18, 2022
@github-jira-sync-bot github-jira-sync-bot added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. and removed Priority: P3 May be fixed according to the position in the backlog. labels Apr 19, 2022
@m2-community-project m2-community-project bot added this to Dev In Progress in High Priority Backlog Apr 19, 2022
@m2-community-project m2-community-project bot removed this from Ready for Development in Low Priority Backlog Apr 19, 2022
@LaurensFranken
Copy link

LaurensFranken commented Jun 13, 2023

Getting the same issue but with url_key contact. Magento version 2.4.5-p2.
There are no other CMS pages with the same url key, nor are there any redirects setup for that particular key. The option Add Store Code to Urls is configured to "No". This used to work in the previous version (Magento 2.3.5-p2).

image

@kpitn
Copy link

kpitn commented Dec 1, 2023

This error is not due to specicif key reserved.

To reproduce the bug you can do :

ex : you create a /faq page with all store
=> Magento generate all url_rewrite with all store

you want to create a page for /faq for a specific store
=> You have this error : "The value specified in the URL Key field would generate a URL that already exists."

Here is the patch to fix the bug :

--- Observer/ProcessUrlRewriteSavingObserver.php
+++ Observer/ProcessUrlRewriteSavingObserver.php
@@ -46,9 +46,15 @@

         if ($cmsPage->dataHasChangedFor('identifier')
             || $cmsPage->dataHasChangedFor('store_id')
-            || $cmsPage->getData('rewrites_update_force')
         ) {
             $urls = $this->cmsPageUrlRewriteGenerator->generate($cmsPage);
+
+            if ($cmsPage->getStoreId()) {
+                $this->urlPersist->deleteByData([
+                    UrlRewrite::REQUEST_PATH => $cmsPage->getIdentifier(),
+                    UrlRewrite::STORE_ID     => $cmsPage->getStoreId(),
+                ]);
+            }

             $this->urlPersist->deleteByData([
                 UrlRewrite::ENTITY_ID => $cmsPage->getId(),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Content Component: Cms Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: dev in progress Reported on 2.4.3-p1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
High Priority Backlog
  
Dev In Progress
Development

No branches or pull requests