Skip to content

Commit

Permalink
Use urllib.quote on str, not unicode, for image titles
Browse files Browse the repository at this point in the history
  • Loading branch information
Pokechu22 committed Jun 25, 2023
1 parent 54d9d80 commit 799bce4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dumpgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,8 @@ def generateImageDump(config={}, other={}, images=[], start='', session=None):
title = u'Image:%s' % (filename)
try:
if config['xmlrevisions'] and config['api'] and config['api'].endswith("api.php"):
r = session.get(config['api'] + u"?action=query&export&exportnowrap&titles=%s" % urllib.quote(title))
quoted_title = urllib.quote(title.encode('utf-8')).decode('utf-8')
r = session.get(config['api'] + u"?action=query&export&exportnowrap&titles=%s" % quoted_title)
xmlfiledesc = r.text
else:
xmlfiledesc = getXMLFileDesc(
Expand Down

0 comments on commit 799bce4

Please sign in to comment.