diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1ee62845d..c880ecafb 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -14,7 +14,7 @@ Changelog * Fix: Email templates and document uploader now support custom `STATICFILES_STORAGE` (Jonny Scholes) * Fix: Removed alignment options (deprecated in HTML and not rendered by Wagtail) from `TableBlock` context menu (Moritz Pfeiffer) * Fix: Fixed incorrect CSS path on ModelAdmin's "choose a parent page" view - + * Fix: Prevent empty redirect by overnormalisation (Franklin Kingma, Ludolf Takens) 1.5.2 (08.06.2016) ~~~~~~~~~~~~~~~~~~ diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index c539e9d31..b02297151 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -143,6 +143,8 @@ Contributors * Jonny Scholes * Richard McMillan * Johannes Spielmann +* Franklin Kingma +* Ludolf Takens Translators =========== diff --git a/docs/releases/1.6.rst b/docs/releases/1.6.rst index cd435fb81..cacaba4d7 100644 --- a/docs/releases/1.6.rst +++ b/docs/releases/1.6.rst @@ -29,6 +29,7 @@ Bug fixes * Email templates and document uploader now support custom ``STATICFILES_STORAGE`` (Jonny Scholes) * Removed alignment options (deprecated in HTML and not rendered by Wagtail) from ``TableBlock`` context menu (Moritz Pfeiffer) * Fixed incorrect CSS path on ModelAdmin's "choose a parent page" view + * Prevent empty redirect by overnormalisation Upgrade considerations diff --git a/wagtail/wagtailredirects/models.py b/wagtail/wagtailredirects/models.py index 652b2f1ba..a9e07def2 100644 --- a/wagtail/wagtailredirects/models.py +++ b/wagtail/wagtailredirects/models.py @@ -64,7 +64,7 @@ class Redirect(models.Model): if not path.startswith('/'): path = '/' + path - if path.endswith('/'): + if path.endswith('/') and len(path) > 1: path = path[:-1] # Parameters must be sorted alphabetically diff --git a/wagtail/wagtailredirects/tests.py b/wagtail/wagtailredirects/tests.py index bf9858e20..dec1b8a68 100644 --- a/wagtail/wagtailredirects/tests.py +++ b/wagtail/wagtailredirects/tests.py @@ -76,6 +76,8 @@ class TestRedirects(TestCase): '/Hello/world.htm;fizz=three;buzz=five?foo=Bar&Baz=quux2' )) + self.assertEqual('/', normalise_path('/')) # '/' should stay '/' + # Normalise some rubbish to make sure it doesn't crash normalise_path('This is not a URL') normalise_path('//////hello/world')