cms icon indicating copy to clipboard operation
cms copied to clipboard

Duplicate entry slugs allowed when using another field in route

Open stuartcusackie opened this issue 1 year ago • 0 comments

Bug description

I'm trying to workaround the current limitation with multi-entry routing patterns. For example, a pattern like this is not possible: /{relatedEntry:slug}/{slug}

So my workaround was to have use a select field called base_path and this route pattern: /{base_path}/{slug}

It's not ideal because it requires additional fields to be configured per entry, but it was acceptable.

The problem I have now is that duplicate slugs are passing validation. So I'm ending up with conflicting urls like:

/project1/test-entry
/project1/test-entry

So it seems that the value of the additional field in the route pattern isn't being checked and non-unique urls are passing.

To solve this I am going with a custom routing patterns, redirects and custom live preview routes, but I'm not too confident on all of that, especially when it's a multisite.

Thanks.

How to reproduce

  1. Set up collection routing based on slug and another field.
  2. Create two entries with the same slug.

Logs

No response

Environment

Version: 3.3.30 PRO
Laravel Version: 9.25.1
PHP Version: 8.1.1

Installation

Existing Laravel app

Antlers Parser

No response

Additional details

No response

stuartcusackie avatar Aug 25 '22 09:08 stuartcusackie