Opened 12 months ago

Closed 11 months ago

Last modified 11 months ago

#22315 closed Bug (fixed)

str/bytes mismatch in ManifestFilesMixin causes failure on Python 3

Reported by: evansd 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 12 months ago by evansd

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 12 months ago by charettes

  • Triage Stage changed from Unreviewed to Accepted

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

  • Resolution set to fixed
  • Status changed from new to closed

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 11 months 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