1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

Ensure CDX status is a string (#739)

If a CDXJ entry has a status that is an int that can cause problems in
multiple places in pywb. This change ensures that int status lines are
converted to str.
This commit is contained in:
Ed Summers 2022-08-09 18:04:42 -04:00 committed by GitHub
parent 4f1a6303fa
commit a97ad7ebbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -251,7 +251,11 @@ class CDXObject(OrderedDict):
@classmethod
def json_decode(cls, string):
return json_decode(string, object_pairs_hook=OrderedDict)
cdx_block = json_decode(string, object_pairs_hook=OrderedDict)
# other parts of pywb expect status to be a string and not an integer
if cdx_block and type(cdx_block.get('status')) == int:
cdx_block['status'] = str(cdx_block['status'])
return cdx_block
#=================================================================