Modify

Opened 6 months ago

Closed 5 months ago

Last modified 5 months ago

#11707 closed defect (fixed)

Backlinks for Unicode page name

Reported by: theYT <dev@…> Owned by: jomae
Priority: normal Component: BackLinksMacro
Severity: normal Keywords: unicode regex regexp
Cc: Trac Release: 1.0

Description

Pages with unicode (non-ASCII) name are not matched (filtered out) when testing with regex.

Patch file attached. (test with r13390)

Attachments (1)

macro.py.patch (515 bytes) - added by theYT <dev@…> 6 months ago.

Download all attachments as: .zip

Change History (5)

Changed 6 months ago by theYT <dev@…>

comment:1 Changed 6 months ago by rjollos

  • Owner changed from trapanator to rjollos
  • Status changed from new to accepted

comment:2 Changed 6 months ago by jun66j5

It seems backlinks_page should be escaped in regular expression, e.g. Languages/C++.

  • backlinks/macro.py

     
    8181        WHERE w1.version = w2.version AND w1.name = w2.name AND 
    8282        (w1.text %s)""" % db.like(), ('%' + db.like_escape(backlinks_page) + '%',)) 
    8383 
     84    pattern = re.compile(r'\b%s\b' % re.escape(backlinks_page), re.UNICODE) 
    8485    backlinked_pages = [] 
    8586    for page, text in cursor: 
    8687        if page != backlinks_page and page != caller_page and \ 
    87            re.search(r'\b%s\b' % backlinks_page, text): 
     88           pattern.search(text): 
    8889            backlinked_pages.append(page) 
    8990 
    9091    return backlinked_pages 

comment:3 Changed 5 months ago by rjollos

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

In 13928:

7.0dev: Match pages with unicode characters in page name. Fixes #11707.

Patch by Jun Omae.

comment:4 Changed 5 months ago by rjollos

  • Owner changed from rjollos to jomae

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.