Skip to content

Commit a97ad7e

Browse files
authored
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.
1 parent 4f1a630 commit a97ad7e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pywb/warcserver/index/cdxobject.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,11 @@ def __le__(self, other):
251251

252252
@classmethod
253253
def json_decode(cls, string):
254-
return json_decode(string, object_pairs_hook=OrderedDict)
254+
cdx_block = json_decode(string, object_pairs_hook=OrderedDict)
255+
# other parts of pywb expect status to be a string and not an integer
256+
if cdx_block and type(cdx_block.get('status')) == int:
257+
cdx_block['status'] = str(cdx_block['status'])
258+
return cdx_block
255259

256260

257261
#=================================================================

0 commit comments

Comments
 (0)