Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years 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@…> 4 years ago.

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by theYT <dev@…>

Attachment: macro.py.patch added

comment:1 Changed 4 years ago by Ryan J Ollos

Owner: changed from Trap to Ryan J Ollos
Status: newaccepted

comment:2 Changed 4 years ago by Jun Omae

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 4 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 13928:

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

Patch by Jun Omae.

comment:4 Changed 4 years ago by Ryan J Ollos

Owner: changed from Ryan J Ollos to jomae

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain jomae.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.