Skip to content

Conversation

matthiask
Copy link
Member

@matthiask matthiask commented Jul 22, 2025

Description

The JSON serialization used by the new serializable mechanism compressed the StaticFile dataclass down to a single string without an .url attribute. Change the code to use a tuple instead to avoid this problem.

Fixes #2160

Checklist:

  • I have added the relevant tests for this change.
  • I have added an item to the Pending section of docs/changes.rst.

The JSON serialization used by the new serializable mechanism compressed
the `StaticFile` dataclass down to a single string without an `.url`
attribute. Change the code to use a tuple instead to avoid this problem.
@matthiask matthiask requested a review from tim-schilling July 22, 2025 14:47
Copy link
Member

@tim-schilling tim-schilling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning this up!

@matthiask matthiask merged commit cda2553 into django-commons:main Jul 22, 2025
25 checks passed
@matthiask matthiask deleted the 2160 branch July 22, 2025 14:53
awdem added a commit to DemocracyClub/WhoCanIVoteFor that referenced this pull request Oct 13, 2025
django-debug-toolbar 6.0.0 changed how it collects static file links (django-commons/django-debug-toolbar#2162)
for the staticfiles panel so that it uses django's staticfile finders. These finders consider paths with leading slashes as unsafe so
they won't load them. The leading slashes are a bug anyway, because they're redundant so I've removed them.
awdem added a commit to DemocracyClub/WhoCanIVoteFor that referenced this pull request Oct 13, 2025
django-debug-toolbar 6.0.0 changed how it collects static file links (django-commons/django-debug-toolbar#2162)
for the staticfiles panel so that it uses django's staticfile finders. These finders consider paths with leading slashes as unsafe so
they won't load them. The leading slashes are a bug anyway, because they're redundant so I've removed them.
awdem added a commit to DemocracyClub/WhoCanIVoteFor that referenced this pull request Oct 14, 2025
django-debug-toolbar 6.0.0 changed how it collects static file links (django-commons/django-debug-toolbar#2162)
for the staticfiles panel so that it uses django's staticfile finders. These finders consider paths with leading slashes as unsafe so
they won't load them. The leading slashes are a bug anyway, because they're redundant so I've removed them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Staticfiles in TemplatesPanel aren't allowing viewing static file content

2 participants