Opened 9 months ago

Closed 7 months ago

Last modified 7 months ago

#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)

comment:1 by Natalia Bidart, 9 months ago

Component: Documentationcontrib.staticfiles
Triage Stage: UnreviewedAccepted

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.

in reply to:  1 comment:2 by Patrick Rauscher, 9 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 Natalia Bidart, 7 months ago

Triage Stage: AcceptedReady for checkin

comment:4 by Natalia <124304+nessita@…>, 7 months ago

Resolution: fixed
Status: newclosed

In 116e2252:

Fixed #34813 -- Doc'd usage of integrity HTML attribute with ManifestStaticFilesStorage.

comment:5 by Natalia <124304+nessita@…>, 7 months ago

In bf8aac3:

[5.0.x] Fixed #34813 -- Doc'd usage of integrity HTML attribute with ManifestStaticFilesStorage.

Backport of 116e225266c511dfc0bfc96c8497e9c8aaa4d004 from main

comment:6 by Natalia <124304+nessita@…>, 7 months ago

In 3d23706:

[4.2.x] Fixed #34813 -- Doc'd usage of integrity HTML attribute with ManifestStaticFilesStorage.

Backport of 116e225266c511dfc0bfc96c8497e9c8aaa4d004 from main

Note: See TracTickets for help on using tickets.
Back to Top