summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMatthew Stell <matthewb@noriker.co.uk>2025-06-24 07:27:52 +0100
committernessita <124304+nessita@users.noreply.github.com>2025-07-01 15:24:34 -0300
commit7feafd79a481216cdd85b4828e749fc5efacb8db (patch)
treeb7f2aa9a5394bbbc46f0c02d04b515779e7d9247 /django
parent58fc40427f2928190c8d273ceff2121b738e768b (diff)
Fixed #35846 -- Ensured consistent path ordering in ManifestStaticFilesStorage manifest files.
This change reuses the existing sorting of `hashed_files` in `ManifestStaticFilesStorage.save_manifest` to also store a sorted `paths` mapping in the manifest file. This ensures stable manifest output that does not change unnecessarily.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/staticfiles/storage.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py
index 95e71e45fc..2ec107d55a 100644
--- a/django/contrib/staticfiles/storage.py
+++ b/django/contrib/staticfiles/storage.py
@@ -496,11 +496,12 @@ class ManifestFilesMixin(HashedFilesMixin):
self.save_manifest()
def save_manifest(self):
+ sorted_hashed_files = sorted(self.hashed_files.items())
self.manifest_hash = self.file_hash(
- None, ContentFile(json.dumps(sorted(self.hashed_files.items())).encode())
+ None, ContentFile(json.dumps(sorted_hashed_files).encode())
)
payload = {
- "paths": self.hashed_files,
+ "paths": dict(sorted_hashed_files),
"version": self.manifest_version,
"hash": self.manifest_hash,
}