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

Urlresolver does not resolve path "/" correctly when multiple homepages has the same identifier #33615

Closed
1 of 5 tasks
capkafitz opened this issue Jul 28, 2021 · 15 comments
Closed
1 of 5 tasks
Assignees
Labels
Area: APIs Component: GraphQL GraphQL Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.0 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S1 Affects critical data or functionality and forces users to employ a workaround.

Comments

@capkafitz
Copy link

capkafitz commented Jul 28, 2021

Preconditions (*)

  1. Magento 2.4.0

Steps to reproduce (*)

  1. Create for multiple stores a cms page with the same identifier (in this case 'home').
  2. Go to Configuration > General > Web > Default Pages
  3. Set for each store the newly created page as homepage, example in the database:
    image
  4. Execute graphQl query urlresolver:
    image
  5. Result for default store (stored in database without delimiter):
    image
  6. Result for store where homepage value is stored in database with delimiter:
    image

Expected result (*)

  1. Result for store where homepage value is stored in database with delimiter should have a correct url resolver response:
    image

Actual result (*)

  1. Actual result equals null
    image

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”.
@m2-assistant
Copy link

m2-assistant bot commented Jul 28, 2021

Hi @capkafitz. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

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

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

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

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


⚠️ 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, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

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

@capkafitz
Copy link
Author

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @capkafitz. Thank you for your request. I'm working on Magento instance for you.

@capkafitz
Copy link
Author

I can confirm it is reproducible on the 2.4-develop instance:

  1. Two stores views:
    image

  2. 2 pages with the same identifier, each page for one store view:
    image

  3. Set each page as homepage in the configuration:
    image
    image

  4. Urlresolver request via graphQl:
    Correct response for default store (default):
    image

Null response for second store (default_2):
image

@capkafitz
Copy link
Author

capkafitz commented Jul 28, 2021

Fixed issue in our project with following patch:

--- a/vendor/magento/module-cms-url-rewrite-graph-ql/Model/Resolver/UrlRewrite/HomePageUrlLocator.php	2020-07-20 13:13:08.000000000 +0200
+++ b/vendor/magento/module-cms-url-rewrite-graph-ql/Model/Resolver/UrlRewrite/HomePageUrlLocator.php	2021-07-28 14:00:37.830555850 +0200
@@ -40,6 +40,10 @@
                 Page::XML_PATH_HOME_PAGE,
                 ScopeInterface::SCOPE_STORE
             );
+            $homePageDelimiterPosition = strrpos($homePageUrl, '|');
+            if ($homePageDelimiterPosition) {
+                $homePageUrl = substr($homePageUrl, 0, $homePageDelimiterPosition);
+            }
             return $homePageUrl;
         }
         return null;

@capkafitz capkafitz changed the title GraphQl HomepageUrlLocator does not take any delimiter into account Urlresolver does not resolve path "/" correctly when multiple homepages has the same identifier Jul 29, 2021
@engcom-November engcom-November self-assigned this Jul 29, 2021
@m2-assistant
Copy link

m2-assistant bot commented Jul 29, 2021

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 engcom-November added Component: GraphQL GraphQL Reported on 2.4.0 Indicates original Magento version for the Issue report. labels Jul 29, 2021
@engcom-November
Copy link

engcom-November commented Aug 2, 2021

Verified the issue on Magento2.4-develop branch and the issue is reproducible:
Steps to reproduce:

  1. Magento - 2 Store views (Ref Guide)
  2. Create CMS page for default store (Admin - Content - Pages - Add New Page - Pages in Websites - Select Default Store View) and Save
  3. Create CMS page for new Store using same above url-key (Admin - Content - Pages - Add New Page - Pages in Websites - Select your new Store View) and Save.
  4. Clear Cache
  5. Go to Configuration > General > Web (Change Scope of the website to "Default Store View") > Default Pages > CMS Home Page -> Select newly created page for default Store and Save
  6. Go to Configuration > General > Web (Change Scope of the website to "New Store view") > Default Pages > CMS Home Page -> Select newly created page for new Store and Save
  7. Execute graphQl query urlresolver for default store: - No issue
  8. Execute graphQL query Urlresolver for new store - Issue
    Issue: Correct response for default store (default) but getting Null response for second store

Screenshot 2021-08-25 at 9 52 50 PM

Default Store:
Screenshot 2021-08-25 at 9 53 25 PM

Note: This issue is also reproducible for default Store with below Steps:

  1. When CMS page is created 1st for new store and set the same url-key for Default Store CMS page
  2. Go to Configuration > General > Web (Change Scope of the website to "New Store view") > Default Pages > CMS Home Page -> Select newly created page for new Store and Save
  3. Go to Configuration > General > Web (Change Scope of the website to "Default Store view") > Default Pages > CMS Home Page -> Select newly created page for default Store and Save
  4. Execute graphQl query urlresolver for france(new Store) store: - No issue
  5. Execute graphQL query Urlresolver for default store - Issue
    Issue: Null response for default store. Correct response for new store

Screenshot 2021-08-25 at 9 55 35 PM

Screenshot 2021-08-25 at 9 55 48 PM

@engcom-November engcom-November added 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 Aug 2, 2021
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board Aug 2, 2021
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-November
Thank you for verifying the issue. Based on the provided information internal tickets MC-42964 were created

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.

@engcom-Hotel engcom-Hotel added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Aug 3, 2021
@m2-community-project m2-community-project bot added this to Ready for Development in High Priority Backlog Aug 3, 2021
@sergiy-v
Copy link
Contributor

@magento I am working on this

@mariusboia
Copy link

@magento add to contributors team

@m2-assistant
Copy link

m2-assistant bot commented Oct 7, 2021

Hi @mariusboia! 👋
Thank you for joining. Please accept team invitation 👉 here 👈 and add your comment one more time.

@mariusboia
Copy link

@magento I'm working on it

@mariusboia mariusboia removed their assignment Oct 11, 2021
@m2-community-project m2-community-project bot moved this from Dev In Progress to Ready for Development in High Priority Backlog Oct 11, 2021
@yogesh-valiya
Copy link
Member

@magento I'm working on it

@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Oct 28, 2021
@cpartica cpartica added Severity: S1 Affects critical data or functionality and forces users to employ a workaround. Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: ready for dev and removed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: dev in progress labels Feb 10, 2022
@m2-community-project m2-community-project bot moved this from Dev In Progress to Ready for Development in High Priority Backlog Feb 10, 2022
@m2-community-project m2-community-project bot moved this from Dev In Progress to Ready for Development in High Priority Backlog Feb 10, 2022
@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Feb 17, 2022
@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Feb 17, 2022
@m2-community-project m2-community-project bot moved this from Dev In Progress to Pull Request In Progress in High Priority Backlog Feb 18, 2022
@m2-community-project m2-community-project bot moved this from Dev In Progress to Pull Request In Progress in High Priority Backlog Feb 18, 2022
@engcom-Alfa
Copy link
Contributor

Hi @capkafitz ,
Thanks for your reported bug, the internal team has fixed and delivered this issue successfully.
Please find related commits HERE.

Kindly upgrade to the latest 2.4-develop to retest the case.
In case of any Magento related issues, you may please report a new bug with all the information like Preconditions, detailed steps to reproduce, expected and actual Results along with screenshots/ screen recordings possibly.

For any Magento related references, you may refer to the Magento user guide.

Thanks!

@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in High Priority Backlog Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: APIs Component: GraphQL GraphQL Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.0 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S1 Affects critical data or functionality and forces users to employ a workaround.
Projects
Development

No branches or pull requests

10 participants