Merge pull request #442 from Pokechu22/missing-image-description

Fix crash when the image description is missing for an image containing non-ascii characters
pull/429/merge
nemobis 2 years ago committed by GitHub
commit ea5e130517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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')

Loading…
Cancel
Save