From cad7260d7c763dd5a586ae6e79840da3632ef291 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 23 Oct 2022 16:29:30 -0700 Subject: [PATCH] Fix crash when the image description is missing for an image containing non-ascii characters title is already unicode, so we shouldn't need to decode it (and don't in generateXMLDump). --- dumpgenerator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dumpgenerator.py b/dumpgenerator.py index d99cb68..fd09b4c 100755 --- a/dumpgenerator.py +++ b/dumpgenerator.py @@ -1515,8 +1515,8 @@ def generateImageDump(config={}, other={}, images=[], start='', session=None): imagefile.write(r.content) imagefile.close() # saving description if any + title = u'Image:%s' % (filename) try: - title = u'Image:%s' % (filename) if config['xmlrevisions'] and config['api'] and config['api'].endswith("api.php"): r = session.get(config['api'] + u"?action=query&export&exportnowrap&titles=%s" % title) xmlfiledesc = r.text @@ -1529,7 +1529,7 @@ def generateImageDump(config={}, other={}, images=[], start='', session=None): xmlfiledesc = '' logerror( config=config, - text=u'The page "%s" was missing in the wiki (probably deleted)' % (title.decode('utf-8')) + text=u'The page "%s" was missing in the wiki (probably deleted)' % title ) f = open('%s/%s.desc' % (imagepath, filename2), 'w')