Fix #2533: Prevent removal of '/' when redirect from url is just '/' (#2721)

pull/2720/merge
Ludolf Takens 2016-06-16 12:48:45 +02:00 zatwierdzone przez Matt Westcott
rodzic 852a6de301
commit e995bc0e19
5 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -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)
~~~~~~~~~~~~~~~~~~

Wyświetl plik

@ -143,6 +143,8 @@ Contributors
* Jonny Scholes
* Richard McMillan
* Johannes Spielmann
* Franklin Kingma
* Ludolf Takens
Translators
===========

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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')