contao / news-bundle

[READ-ONLY] Contao News Bundle
GNU Lesser General Public License v3.0
9 stars 14 forks source link

id is unneccessarily appended to alias #17

Closed patrickjDE closed 7 years ago

patrickjDE commented 7 years ago

Under certain circumstances the id is appended to an auto-generated alias, although it would be unique without it. This happens when:

How to reproduce this in the online demo:

  1. Create a new news item
  2. Leave the alias field blank
  3. Select no author (or do anything else that will trigger a form error)
  4. Save
  5. Correct the error
  6. Save again The news item's alias will now contain the id, even though it would have been unique without it.

As far as I can tell this is caused by the generateAlias method which only checks the number of the alias' occurencies. The case where the generated alias already exists, but actually belongs to the item for which it was generated is not handled.

patrickjDE commented 7 years ago

This issue might also apply to other bundles using the same logic (Events comes to mind)

leofeyer commented 7 years ago

Closed in favor of #18.