Dotclear

Ticket #2254 (closed defect: fixed)

Opened 8 years ago

Last modified 8 years ago

Error with some type of auto-generated URI

Reported by: tomek Owned by: team
Priority: normal Milestone:
Component: module:core Version: 2.12.1
Severity: normal Keywords:
Cc:

Description

I got this error when creating several posts with the same title. Usually, it increments like Title-this, Title-this2, Title-this3. In my case, the title has brackets, it seems to be the problem, but I'm not sure.

Here is the error message when trying to create the post:

Duplicate entry 'LA-GRÈVE-[STRIKE]2-post-en' for key 'dc_uk_post_url' (1062)

Change History

comment:1 Changed 8 years ago by franck

Bon problème de requête SQL, puisque qu'avec celle-ci (et un billet créé ce jour avec cette URL), il ne retrouve rien :

SELECT post_url FROM dc_post WHERE post_url = '2017/09/14/LA-GRÈVE-[STRIKE]' AND post_id <> 11117 AND blog_id = 'default' ORDER BY post_url DESC

Probablement un problème d'échappement de caractères particulier, je soupçonne les [ et/ou ]

comment:2 Changed 8 years ago by franck

Ok j'ai compris, c'est la requête suivante (qui recherche toutes les URLs numérotées) qui utilise le mot-clé REGEXP et dont les [ et ] posent problème ( [STRIKE] ) :

SELECT post_url FROM dc_post WHERE post_url REGEXP '^2017/09/14/LA-GRÈVE-[STRIKE][0-9]+$' AND post_id <> 11117 AND blog_id = 'default' ORDER BY post_url DESC 

comment:3 Changed 8 years ago by franck

Correction à venir, sachant qu'il peut y avoir des effets de bord avec le plugin tweakurl — qui n'intervient que sur l'URL finale — dans certains cas très particuliers (et rares)

comment:4 Changed 8 years ago by franck <carnet.franck.paul@…>

  • Status changed from new to closed
  • Resolution set to fixed

(In [940d0c9a5dac]) Escapes REGEXP reserved characters (or SQLite equivalent) before searching existing URLs. Should fixes #2254

comment:5 Changed 8 years ago by tomek

Cool, merci ! :-)

Note: See TracTickets for help on using tickets.

Sites map