verbb / navigation

A Craft CMS plugin to create navigation menus for your site.
Other
90 stars 23 forks source link

Error when saving page: "Could not generate a unique URI based on the URI format." #180

Closed benatleith closed 4 years ago

benatleith commented 4 years ago

Description

Unable to save pages, with error "Could not generate a unique URI based on the URI format." shown. This only happens when there is a Navigation node associated with the page.

It only seems to occur for singles, except the homepage which seems to work fine.

It looks like the query in ElementHelper::_isUniqueUri() is returning a non zero value due to the additional record the plugin adds to element_sites. I don't know why the homepage is not affected.

Also managed to replicate in 3.5.1 with plugin version 1.3.23, so it's potentially not a brand new issue.

Steps to reproduce

  1. Spin up a fresh Craft 3.5.2 instance and install latest verbb/navigation plugin
  2. Create a single Test Page with slug 'test-page'
  3. Create a Navigation (node propagation and max depth options make no difference to the result)
  4. Add a Navigation node pointing to Entry 'Test Page'
  5. Edit the page, hit save, error as described

Additional info

Additional context

engram-design commented 4 years ago

I actually can't replicate this on a brand new install following your steps. What I am seeing is that on each save, the page's slug is getting appended with -1, so test-page-1, test-page-1-1, etc.

Should be fixed in 1.3.25, but am concerned that you had 1.3.23 installed and still seeing this issue. I believe the issue was introduced in 1.3.24. Just let me know if there's still issues.

benatleith commented 4 years ago

Thanks @engram-design - I've updated to 1.3.25 and can no longer replicate the issue. 👍