Revert "Strip Unicode NULL chars when normalizing paths"

This reverts commit 882f8f3cf8.

Conflicts:
	CHANGELOG.txt
	CONTRIBUTORS.rst
	docs/releases/2.2.rst
This commit is contained in:
Matt Westcott 2018-07-03 16:45:27 +01:00
parent 9ef8ee2d7f
commit 3aff9f76e4
5 changed files with 1 additions and 10 deletions

View file

@ -24,7 +24,6 @@ Changelog
* Fix: Remove duplicate border radius of avatars (Benjamin Thurm)
* Fix: Site.get_site_root_paths() preferring other sites over the default when some sites share the same root_page (Andy Babic)
* Fix: Pages with missing model definitions no longer crash the API (Abdulmalik Abdulwahab)
* Fix: Strip null characters from paths when checking for redirects (Andrew Crewdson)
* Fix: Rich text image chooser no longer skips format selection after a validation error (Matt Westcott)

View file

@ -308,7 +308,6 @@ Contributors
* Daniele Procida
* Catherine Farman
* Abdulmalik Abdulwahab
* Andrew Crewdson
* Aram Dulyan
Translators

View file

@ -37,7 +37,6 @@ Bug fixes
* Remove duplicate border radius of avatars (Benjamin Thurm)
* Site.get_site_root_paths() preferring other sites over the default when some sites share the same root_page (Andy Babic)
* Pages with missing model definitions no longer crash the API (Abdulmalik Abdulwahab)
* Strip null characters from paths when checking for redirects (Andrew Crewdson)
* Rich text image chooser no longer skips format selection after a validation error (Matt Westcott)
Upgrade considerations

View file

@ -71,12 +71,8 @@ class Redirect(models.Model):
parameters_components = parameters.split(';')
parameters = ';'.join(sorted(parameters_components))
query_string = url_parsed[4]
# Strip Unicode NULLs (U+0000) for safety and Postgres compatibility
query_string = query_string.replace('%00', '')
# Query string components must be sorted alphabetically
query_string = url_parsed[4]
query_string_components = query_string.split('&')
query_string = '&'.join(sorted(query_string_components))

View file

@ -78,8 +78,6 @@ class TestRedirects(TestCase):
self.assertEqual('/', normalise_path('/')) # '/' should stay '/'
self.assertEqual('/foo?bar=baz', normalise_path('/foo?bar=baz%00')) # Strip NULLs
# Normalise some rubbish to make sure it doesn't crash
normalise_path('This is not a URL')
normalise_path('//////hello/world')