#34813 closed Cleanup/optimization (fixed)
Docs miss note about invalid integrity with ManifestStaticFilesStorage
Reported by: | Patrick Rauscher | Owned by: | nobody |
---|---|---|---|
Component: | contrib.staticfiles | Version: | 4.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When using ManifestStaticFilesStorage, it will modify your static contents e.g. to make source maps work etc. This is obviously a good thing, but makes the integrity-attribute of <link> or <script> tags useless. Especially if you are in the process of insourcing external resources, this should be documented, e.g. with a note in the ManifestStaticFilesStorage, possibly noting the error message to be expected ("Failed to find a valid digest in the integrity attribute", at least with Chrome).
I'd be happy to help with a PR, just note that I'm new to contributing to django, so I might need some help in this process.
Change History (6)
follow-up: 2 comment:1 by , 16 months ago
Component: | Documentation → contrib.staticfiles |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 16 months ago
Has patch: | set |
---|
Thanks for accepting! I drafted a PR at https://github.com/django/django/pull/17227
I was insourcing jquery & bootstrap as our application moved to a closed network. So I thought it would be a simple download of resources and shipping them using {% static %}. This works until production with DEBUG=False, where ManifestStaticFileStorage would change jQuery to match the source map. As I did not remove the integity-attribute, loading failed. While I was searching for the error message, I could not find a hint to this behavior, so I thought about adding a note in the reference.
Replying to Natalia Bidart:
Hello! Thank you for your ticket.
I'm tentatively accepting though I would really appreciate if you could provide a reproducer or a concrete example so I try to reproduce the ticket description.
In the meantime, you are welcome to propose a PR with the doc changes.
comment:3 by , 14 months ago
Triage Stage: | Accepted → Ready for checkin |
---|
Hello! Thank you for your ticket.
I'm tentatively accepting though I would really appreciate if you could provide a reproducer or a concrete example so I try to reproduce the ticket description.
In the meantime, you are welcome to propose a PR with the doc changes.