From 31358535b161379d86dc01dbbcdcfbc42e7c9efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A6var=20=C3=96fj=C3=B6r=C3=B0=20Magn=C3=BAsson?= Date: Mon, 19 Oct 2015 15:57:16 +0000 Subject: [PATCH] Remove the length argument to URLify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The URLify function supplied by django does not need a length argument in order to work. The problem with supplying the length argument is that when you have Unicode characters that are translated to two characters in the slug version, the resulting slug will be missing one character for each such double character. Example: Æ or æ is translated as ae when slugified. A call to URLify would then be: URLify("kjaftæði", 8) which would result in the slug "kjaftaed", since the slug is 9 characters in length due to æ being expanded to two characters. URLify("kjaftæði") works fine and returns "kjaftaedi". --- wagtail/wagtailadmin/static_src/wagtailadmin/js/page-editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wagtail/wagtailadmin/static_src/wagtailadmin/js/page-editor.js b/wagtail/wagtailadmin/static_src/wagtailadmin/js/page-editor.js index 99f9f2b66..e31a0ef3b 100644 --- a/wagtail/wagtailadmin/static_src/wagtailadmin/js/page-editor.js +++ b/wagtail/wagtailadmin/static_src/wagtailadmin/js/page-editor.js @@ -296,7 +296,7 @@ function InlinePanel(opts) { function cleanForSlug(val, useURLify) { if (URLify != undefined && useURLify !== false) { // Check to be sure that URLify function exists, and that we want to use it. - return URLify(val, val.length); + return URLify(val); } else { // If not just do the "replace" return val.replace(/\s/g, '-').replace(/[^A-Za-z0-9\-\_]/g, '').toLowerCase(); }