1
0
mirror of https://github.com/django/django.git synced 2024-11-18 07:26:04 +00:00
django/tests/staticfiles_tests
Aymeric Augustin 7f6fbc906a Prevented static file corruption when URL fragment contains '..'.
When running collectstatic with a hashing static file storage backend,
URLs referencing other files were normalized with posixpath.normpath.
This could corrupt URLs: for example 'a.css#b/../c' became just 'c'.

Normalization seems to be an artifact of the historical implementation.
It contained a home-grown implementation of posixpath.join which relied
on counting occurrences of .. and /, so multiple / had to be collapsed.

The new implementation introduced in the previous commit doesn't suffer
from this issue. So it seems safe to remove the normalization.

There was a test for this normalization behavior but I don't think it's
a good test. Django shouldn't modify CSS that way. If a developer has
rendundant /s, it's mostly an aesthetic issue and it isn't Django's job
to fix it. Conversely, if the user wants a series of /s, perhaps in the
URL fragment, Django shouldn't destroy it.

Refs #26249.
2016-02-23 19:35:16 +01:00
..
apps
project Prevented static file corruption when URL fragment contains '..'. 2016-02-23 19:35:16 +01:00
urls
__init__.py
cases.py Refs #26022 -- Used context manager version of assertRaises in tests. 2016-01-29 12:32:18 -05:00
settings.py
storage.py
test_finders.py Refs #26022 -- Used context manager version of assertRaises in tests. 2016-01-29 12:32:18 -05:00
test_forms.py Refs #21221 -- Added test for legacy static usage in form Media. 2016-01-19 06:57:20 -05:00
test_liveserver.py
test_management.py Used call_command return value in staticfiles tests 2016-02-23 09:12:12 +01:00
test_storage.py Prevented static file corruption when URL fragment contains '..'. 2016-02-23 19:35:16 +01:00
test_templatetags.py
test_views.py