Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#22315 closed Bug (fixed)

str/bytes mismatch in ManifestFilesMixin causes failure on Python 3

Reported by: David Evans Owned by: nobody
Component: contrib.staticfiles Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The issue is that load_manifest returns bytes rather than a string which then gets fed into json.loads inside read_manifest resulting in:

TypeError: can't use a string pattern on a bytes-like object

read_manifest doesn't get exercised in the test suite, hence the issue not being spotted.

I'll try to submit a patch soon, but just registering the issue first.

Change History (4)

comment:1 Changed 3 years ago by David Evans

Has patch: set

comment:2 Changed 3 years ago by Simon Charette

Triage Stage: UnreviewedAccepted

comment:3 Changed 3 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In 86dcac463437dce06ddcade10fa3f308436ba608:

Fixed #22315 -- str/bytes mismatch in staticfiles

Previously, ManifestFilesMixin.read_manifest failed in Python 3
because json.loads accepts str not bytes.

comment:4 Changed 3 years ago by Tim Graham <timograham@…>

In ddcbde41eec12f7a84b00635cdbf1c93d4e4d297:

[1.7.x] Fixed #22315 -- str/bytes mismatch in staticfiles

Previously, ManifestFilesMixin.read_manifest failed in Python 3
because json.loads accepts str not bytes.

Backport of 86dcac4634 from master

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