Opened 9 years ago
Closed 7 years ago
#26527 closed Bug (duplicate)
HashedFilesMixin StaticFileStorage can't handle nested assets
Reported by: | Joshua Blum | Owned by: | nobody |
---|---|---|---|
Component: | contrib.staticfiles | Version: | 1.9 |
Severity: | Normal | Keywords: | |
Cc: | emorley@…, Ed Morley | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
There seems to be a bug here if there are nested assets. For example, if i have index.js
which references a partial index.html
, if index.js
is processed first, index.html -> index.<hash-key>.html
. Then if index.html
is processed and rehashed (i.e. this file contains references to index.png
), the <hash-key>
inside of index.js
in incorrect, since index.html
was rehashed to account for it's own static assets. It seems like instead of just substituting the pattern here, we need to recursively rehash the file so the ordering is preserved. Thoughts?
Change History (7)
comment:1 by , 9 years ago
Cc: | added |
---|
comment:2 by , 9 years ago
Easy pickings: | unset |
---|---|
Summary: | Bug in HashedFilesMixin StaticFileStorage → HashedFilesMixin StaticFileStorage can't handle nested assets |
comment:3 by , 9 years ago
I think the problem is similar, however the discussions in those tickets lead to a slightly different solution and wouldn't solve the problem as I've described it. This is the first ticket I am submitted, to add a test should I submit a PR or just show an example?
comment:4 by , 9 years ago
For a test, I usually generate a patch and attach it to the ticket (unless you also plan to immediately start working on a fix, in which case a PR is fine).
comment:5 by , 9 years ago
I've opened a WIP PR for this issue. This is a working fix that I've been using in production for 6 months and it works great. If you need an immediate fix joshblum, try that out, the entire storage.py
file can be backported by itself (confirmed this works with 1.8.12, should work with 1.9 as well).
comment:6 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:7 by , 7 years ago
Cc: | added |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
From reading the source, the problem described here should be fixed in Django 1.11, thanks to #24452.
If it's not, please could you reopen a new issue with full STR.
Many thanks :-)
Possible related tickets or duplicates: #22353, #24452.
If not, could you provide a test for Django's test suite that demonstrates the issue?