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

If a page only has one match, then you can end up with duplicate URLs #84

Open
sean-dunwoody opened this issue Mar 4, 2020 · 1 comment
Labels
bug Something isn't working wordpress

Comments

@sean-dunwoody
Copy link
Contributor

Describe the bug
Duplicate URLs can be created when the API call to WordPress only matches one item.

To Reproduce

  1. Create a page in WordPress that sits on the second level of the site, e.g.

/about-us/the-team

  1. View this page in the frontend to see that it works.
  2. Manipuate the URL so that about-us changes to something else, e.g.

/any-value-in-here/the-team

  1. Page should be returned. This means the same content can be accessed on multiple duplicate (and incorrect URLs)

Expected behavior
The page should only be returned when the exact request URL matches the full URL in WordPress

Additional context
This only seems to happen when the WordPress API returns exactly one match. This is the endpoint in question:

/wp-json/wp/v2/pages?slug=/page-url-here/

This only requests the final segement of the URL, e.g. in the above example:

/about-us/the-team

The query would be:

/wp-json/wp/v2/pages?slug=/the-team/

If this API response returns more than one match, then this error doesn't occur.

I think this is related to the following recent changes:

https://github.com/strata/frontend/pull/83/files

@sean-dunwoody sean-dunwoody added the bug Something isn't working label Mar 4, 2020
@simonrjones
Copy link
Member

Various fixes have been made to CCS to help resolve this.

However, full fix is to access WP API using the post type & post ID which should be possible once we have persistent metadata about pages. See #63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wordpress
Projects
None yet
Development

No branches or pull requests

2 participants