Commit 3727f6d0 authored by Jannis Leidel's avatar Jannis Leidel
Browse files

Fixed #18430 -- Use the FILE_CHARSET setting when reading from a file during...

Fixed #18430 -- Use the FILE_CHARSET setting when reading from a file during post processing with the cached staticfiles storage. Thanks to Brant Young for initial debugging.
parent 0a68a299
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -228,7 +228,7 @@ class CachedFilesMixin(object):

                # ..to apply each replacement pattern to the content
                if name in adjustable_paths:
                    content = original_file.read()
                    content = original_file.read().decode(settings.FILE_CHARSET)
                    converter = self.url_converter(name)
                    for patterns in self._patterns.values():
                        for pattern in patterns:
+5 −0
Original line number Diff line number Diff line
body {
  background: url('window.png');
}

.snowman:before { content: "☃"; }
+207 B
Loading image diff...
+3 −2
Original line number Diff line number Diff line
@@ -498,8 +498,9 @@ class TestCollectionCachedStorage(BaseCollectionTestCase,
        collectstatic_cmd = CollectstaticCommand()
        collectstatic_cmd.set_options(**collectstatic_args)
        stats = collectstatic_cmd.collect()
        self.assertTrue(os.path.join('cached', 'css', 'window.css') in stats['post_processed'])
        self.assertTrue(os.path.join('cached', 'css', 'img', 'window.png') in stats['unmodified'])
        self.assertIn(os.path.join('cached', 'css', 'window.css'), stats['post_processed'])
        self.assertIn(os.path.join('cached', 'css', 'img', 'window.png'), stats['unmodified'])
        self.assertIn(os.path.join('test', 'nonascii.css'), stats['post_processed'])

    def test_cache_key_memcache_validation(self):
        """