Page MenuHomePhabricator

Pywikibot: imagetransfer: error on copy-upload (Commons to Wikisource)
Closed, ResolvedPublicBUG REPORT

Description

Now that copy-uploading from Commons to Wikisource is whitelisted (T294824), PWB can directly perform the copy-upload.

However, this fails with

  File "/home/user/src/pywikibot/pywikibot/specialbots/_upload.py", line 414, in upload_file
    success = imagepage.upload(file_url,
  File "/home/user/src/pywikibot/pywikibot/page/__init__.py", line 2410, in upload
    return self.site.upload(self, source_filename=filename, source_url=url,
  File "/home/user/src/pywikibot/pywikibot/site/_decorators.py", line 92, in callee
    return fn(self, *args, **kwargs)
  File "/home/user/src/pywikibot/pywikibot/site/_apisite.py", line 2882, in upload
    return self.upload(
  File "/home/user/src/pywikibot/pywikibot/site/_decorators.py", line 92, in callee
    return fn(self, *args, **kwargs)
  File "/home/user/src/pywikibot/pywikibot/site/_apisite.py", line 2610, in upload
    raise ValueError('Can request stash information only when '
ValueError: Can request stash information only when using a file name.

This appears to be because the file_key/offset should only be set when there's a filename, not just a file URL.

Event Timeline

Change 736464 had a related patch set uploaded (by Inductiveload; author: Inductiveload):

[pywikibot/core@master] [bugfix]: Upload: Only set filekey/offset for files with names

https://gerrit.wikimedia.org/r/736464

Xqt triaged this task as High priority.

Change 736464 merged by jenkins-bot:

[pywikibot/core@master] [bugfix]: Upload: Only set filekey/offset for files with names

https://gerrit.wikimedia.org/r/736464