Loading django/contrib/staticfiles/storage.py +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class CachedFilesMixin(object): pattern, template = pattern else: template = self.default_template compiled = re.compile(pattern) compiled = re.compile(pattern, re.IGNORECASE) self._patterns.setdefault(extension, []).append((compiled, template)) def file_hash(self, name, content=None): Loading tests/regressiontests/staticfiles_tests/project/documents/cached/styles_insensitive.css 0 → 100644 +1 −0 Original line number Diff line number Diff line @IMporT uRL("other.css"); No newline at end of file tests/regressiontests/staticfiles_tests/tests.py +8 −0 Original line number Diff line number Diff line Loading @@ -542,6 +542,14 @@ class TestCollectionCachedStorage(BaseCollectionTestCase, cache_validator.validate_key(cache_key) self.assertEqual(cache_key, 'staticfiles:821ea71ef36f95b3922a77f7364670e7') def test_css_import_case_insensitive(self): relpath = self.cached_file_path("cached/styles_insensitive.css") self.assertEqual(relpath, "cached/styles_insensitive.2f0151cca872.css") with storage.staticfiles_storage.open(relpath) as relfile: content = relfile.read() self.assertNotIn(b"cached/other.css", content) self.assertIn(b"other.d41d8cd98f00.css", content) # we set DEBUG to False here since the template tag wouldn't work otherwise @override_settings(**dict(TEST_SETTINGS, Loading Loading
django/contrib/staticfiles/storage.py +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class CachedFilesMixin(object): pattern, template = pattern else: template = self.default_template compiled = re.compile(pattern) compiled = re.compile(pattern, re.IGNORECASE) self._patterns.setdefault(extension, []).append((compiled, template)) def file_hash(self, name, content=None): Loading
tests/regressiontests/staticfiles_tests/project/documents/cached/styles_insensitive.css 0 → 100644 +1 −0 Original line number Diff line number Diff line @IMporT uRL("other.css"); No newline at end of file
tests/regressiontests/staticfiles_tests/tests.py +8 −0 Original line number Diff line number Diff line Loading @@ -542,6 +542,14 @@ class TestCollectionCachedStorage(BaseCollectionTestCase, cache_validator.validate_key(cache_key) self.assertEqual(cache_key, 'staticfiles:821ea71ef36f95b3922a77f7364670e7') def test_css_import_case_insensitive(self): relpath = self.cached_file_path("cached/styles_insensitive.css") self.assertEqual(relpath, "cached/styles_insensitive.2f0151cca872.css") with storage.staticfiles_storage.open(relpath) as relfile: content = relfile.read() self.assertNotIn(b"cached/other.css", content) self.assertIn(b"other.d41d8cd98f00.css", content) # we set DEBUG to False here since the template tag wouldn't work otherwise @override_settings(**dict(TEST_SETTINGS, Loading