diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py index 04a5edbd30..dfc3137f76 100644 --- a/django/contrib/staticfiles/storage.py +++ b/django/contrib/staticfiles/storage.py @@ -308,22 +308,23 @@ class HashedFilesMixin: processed_adjustable_paths[name] = (name, hashed_name, processed) paths = {path: paths[path] for path in adjustable_paths} - substitutions = False - + unresolved_paths = [] for i in range(self.max_post_process_passes): - substitutions = False + unresolved_paths = [] for name, hashed_name, processed, subst in self._post_process( paths, adjustable_paths, hashed_files ): # Overwrite since hashed_name may be newer. processed_adjustable_paths[name] = (name, hashed_name, processed) - substitutions = substitutions or subst + if subst: + unresolved_paths.append(name) - if not substitutions: + if not unresolved_paths: break - if substitutions: - yield "All", None, RuntimeError("Max post-process passes exceeded.") + if unresolved_paths: + problem_paths = ", ".join(sorted(unresolved_paths)) + yield problem_paths, None, RuntimeError("Max post-process passes exceeded.") # Store the processed paths self.hashed_files.update(hashed_files) diff --git a/tests/staticfiles_tests/project/loop/baz.css b/tests/staticfiles_tests/project/loop/baz.css new file mode 100644 index 0000000000..4021a1b1e6 --- /dev/null +++ b/tests/staticfiles_tests/project/loop/baz.css @@ -0,0 +1,3 @@ +body { + background-color: #fafafa; +} diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py index d6ea03b744..9ca4d62553 100644 --- a/tests/staticfiles_tests/test_storage.py +++ b/tests/staticfiles_tests/test_storage.py @@ -186,7 +186,9 @@ class TestHashedFiles: err = StringIO() with self.assertRaisesMessage(RuntimeError, "Max post-process passes exceeded"): call_command("collectstatic", interactive=False, verbosity=0, stderr=err) - self.assertEqual("Post-processing 'All' failed!\n\n", err.getvalue()) + self.assertEqual( + "Post-processing 'bar.css, foo.css' failed!\n\n", err.getvalue() + ) self.assertPostCondition() def test_post_processing(self):