Skip to content

Fix for CMS that may not have .html extensions #1029

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

Closed
wants to merge 4 commits into from

Conversation

danrcoull
Copy link

Error:
Cms pages without .html in the url key will never resolve
Any Other Pages without .html wont resolve

Fix:

Add a check count, and try and resolve both .html and not .html urls

Error: 
Cms pages without .html in the url key will never resolve
Any Other Pages without .html wont resolve

Fix:

Add a check count, and try and resolve both .html and not .html urls
@magento-cicd2
Copy link

magento-cicd2 commented Mar 17, 2019

CLA assistant check
All committers have signed the CLA.

@vercel
Copy link

vercel bot commented Mar 17, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

@coveralls
Copy link

coveralls commented Mar 17, 2019

Coverage Status

Coverage decreased (-0.07%) to 76.439% when pulling 94741bf on danrcoull:develop into 4c613fd on magento-research:develop.

Check if extension has html to stop infinate loop
Remove .html extension if it has and check if fetch resolves
@supernova-at
Copy link
Contributor

Related to and maybe dependent on #936 .

Copy link
Contributor

@zetlen zetlen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be the right approach, but per my comment in this review, I think I need a little bit more explanation. Still, thank you so much for addressing this touchy issue.

if (resolve === null) {
if (opts.route.endsWith('.html')) {
opts.route = opts.route.replace('.html', '');
resolve = await fetchRoute(opts)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's say the user clicks on an external ink to venia.com/accessories.html. If that catalog page no longer exists, this function will attempt to look up the entity at accessories. If that's a CMS page, it will display the CMS page without changing the URL in the browser location. Is this what we want?

I think there may be a better place to remove the URL key than this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catalog categories have .html aswell, so unless a cms page is called /checkout then thats the only time i think this wont work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if there used to be an /accessories.html, but that is no longer a category, and instead there is a CMS page called /accessories? That's where I'm worried about a bug. This may need to just redirect instead of silently removing the .html from the active route. Am I missing something?

@ericerway
Copy link

@zetlen can you take a look in review? Thanks!

@zetlen
Copy link
Contributor

zetlen commented Apr 26, 2019

Gotta close this in favor of UPWARD-driven and GraphQL storeInfo driven solutions, since the .html suffix is configurable per Magento instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants