diff options
author | Claude Paroz <claude@2xlibre.net> | 2023-03-12 12:28:00 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-03-12 16:54:20 +0100 |
commit | 03bc92af978f2148c1141673c730f17772cd7037 (patch) | |
tree | b07350231d8d9193c7f9790dc6f55ecc56cfb768 /django | |
parent | 4db33e96d1b5b4ba1a739e15b28835495f78eee4 (diff) | |
download | django-03bc92af978f2148c1141673c730f17772cd7037.tar.gz |
Fixed #34407 -- Reported filename when decoding fails in collectstatic's post_process.
Diffstat (limited to 'django')
-rw-r--r-- | django/contrib/staticfiles/storage.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py index b3ee32e665..df02906ebc 100644 --- a/django/contrib/staticfiles/storage.py +++ b/django/contrib/staticfiles/storage.py @@ -353,7 +353,10 @@ class HashedFilesMixin: # ..to apply each replacement pattern to the content if name in adjustable_paths: old_hashed_name = hashed_name - content = original_file.read().decode("utf-8") + try: + content = original_file.read().decode("utf-8") + except UnicodeDecodeError as exc: + yield name, None, exc, False for extension, patterns in self._patterns.items(): if matches_patterns(path, (extension,)): for pattern, template in patterns: |