[Django] #28688: Unicode slugs are not properly slugified due to javascript limitations

49 views
Skip to first unread message

Django

unread,
Oct 6, 2017, 12:17:52 PM10/6/17
to django-...@googlegroups.com
#28688: Unicode slugs are not properly slugified due to javascript limitations
--------------------------------------------------+------------------------
Reporter: Sævar Öfjörð Magnússon | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------------------+------------------------
When using unicode slugs, and the slug contains a unicode character and a
word from the removelist in urlify.js right after it (e.g. the letter
"a"), the unicode character is detected as a word boundary in javascript
and the text that matches the removelist is stripped from the slug...
The removelist contains the following words:

var removelist = [
"a", "an", "as", "at", "before", "but", "by", "for", "from", "is",
"in", "into", "like", "of", "off", "on", "onto", "per", "since",
"than", "the", "this", "that", "to", "up", "via", "with"
];

And when I try to slugify this text: "Kaupa miða"
The result becomes: "kaupa-mið"

This can be tested using the following line in console:
URLify("Kaupa miða", 255, true)


(only when urlify.js is loaded, of course)

--
Ticket URL: <https://code.djangoproject.com/ticket/28688>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 6, 2017, 1:04:07 PM10/6/17
to django-...@googlegroups.com
#28688: Unicode slugs are not properly slugified due to javascript limitations
-------------------------------------+-------------------------------------
Reporter: Sævar Öfjörð | Owner: nobody
Magnússon |

Type: Bug | Status: new
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/28688#comment:1>

Django

unread,
Oct 7, 2017, 4:23:34 AM10/7/17
to django-...@googlegroups.com
#28688: Unicode slugs are not properly slugified due to javascript limitations
-------------------------------------+-------------------------------------
Reporter: Sævar Öfjörð | Owner: nobody
Magnússon |
Type: Bug | Status: new
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz):

The solution could be to check if the string contains any non-ASCII char
and simply skip the `removelist` removal, as the language is probably not
English in that case.

--
Ticket URL: <https://code.djangoproject.com/ticket/28688#comment:2>

Django

unread,
Oct 9, 2017, 5:48:56 AM10/9/17
to django-...@googlegroups.com
#28688: Unicode slugs are not properly slugified due to javascript limitations
-------------------------------------+-------------------------------------
Reporter: Sævar Öfjörð | Owner: Sævar
Magnússon | Öfjörð Magnússon
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.11

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sævar Öfjörð Magnússon):

* owner: nobody => Sævar Öfjörð Magnússon
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/28688#comment:3>

Django

unread,
Oct 9, 2017, 6:44:06 AM10/9/17
to django-...@googlegroups.com
#28688: Unicode slugs are not properly slugified due to javascript limitations
-------------------------------------+-------------------------------------
Reporter: Sævar Öfjörð | Owner: Sævar
Magnússon | Öfjörð Magnússon
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.11

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sævar Öfjörð Magnússon):

* has_patch: 0 => 1


Comment:

Pull request: https://github.com/django/django/pull/9219

--
Ticket URL: <https://code.djangoproject.com/ticket/28688#comment:4>

Django

unread,
Oct 11, 2017, 2:46:31 AM10/11/17
to django-...@googlegroups.com
#28688: Unicode slugs are not properly slugified due to javascript limitations
-------------------------------------+-------------------------------------
Reporter: Sævar Öfjörð | Owner: Sævar
Magnússon | Öfjörð Magnússon
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/28688#comment:5>

Django

unread,
Oct 12, 2017, 1:12:50 PM10/12/17
to django-...@googlegroups.com
#28688: Unicode slugs are not properly slugified due to javascript limitations
-------------------------------------+-------------------------------------
Reporter: Sævar Öfjörð | Owner: Sævar
Magnússon | Öfjörð Magnússon
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"f90be0a83ef5aa333b19e259faab73ee117d5339" f90be0a8]:
{{{
#!CommitTicketReference repository=""
revision="f90be0a83ef5aa333b19e259faab73ee117d5339"
Fixed #28688 -- Made admin's URLify.js skip removal of English words if
non-ASCII chars are present.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28688#comment:6>

Django

unread,
Oct 24, 2017, 11:15:11 AM10/24/17
to django-...@googlegroups.com
#28688: Unicode slugs are not properly slugified due to javascript limitations
-------------------------------------+-------------------------------------
Reporter: Sævar Öfjörð | Owner: Sævar
Magnússon | Öfjörð Magnússon
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.11

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"8b9a163afa553ee9d57febae69c9eb0c88259012" 8b9a163]:
{{{
#!CommitTicketReference repository=""
revision="8b9a163afa553ee9d57febae69c9eb0c88259012"
Refs #28688 -- Updated a selenium test for admin's URLify.js change.

English words aren't removed if non-ASCII chars are present.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28688#comment:7>

Reply all
Reply to author
Forward
0 new messages