https://bugzilla.wikimedia.org/show_bug.cgi?id=21063
Summary: Upload api exception when using upload by url
Product: MediaWiki
Version: 1.16-svn
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: Normal
Component: Uploading
AssignedTo: [email protected]
ReportedBy: [email protected]
At test wiki I'm playing around with the upload api.
Test wiki is running 1.16alpha-wmf (r57490) at the moment.
First I tried using upload by url through the normal upload interface. That
works just fine. Now I'm trying to use upload by url in the api to upload some
files, but I get an internal_api_error_MWException
I run the following piece of python code:
def api_upload_image(self, debug=False):
"""
Use the upload api to upload the image
"""
#Hacking around to see how the upload api works
#First get an edit token
params1 = {
'action' : 'query',
'prop' : 'info',
'intoken' : 'edit',
'titles' : self.useFilename
}
data1 = query.GetData(params1, self.targetSite, useAPI = True,
encodeTitle = False)
token = data1[u'query'][u'pages']['-1'][u'edittoken']
print token
#token = self.targetSite.getToken()
#Should do some filename checking
#Post all the data to upload the file
params2 = {
'action' : 'upload',
'filename' : self.useFilename,
'comment' : self.description,
#'token' : 'bladiebla',
'token' : token,
#'watch' : '0'
#'ignorewarnings' :
#'file' : file contents
#'enablechunks'
#'chunksessionkey',
#'chunk'
#'done'
'url' : self.url,
'asyncdownload' : 0,
#'httpstatus'
#'sessionkey'
}
print params2
data2 = query.GetData(params2, self.targetSite, useAPI = True,
encodeTitle = False)
print data2
session_key = data2[u'upload']['upload_session_key']
#See the status of the upload
params3 = {
'action' : 'upload',
#'filename' : self.useFilename,
#'comment' : self.description,
'token' : token,
#'watch' : '0'
#'ignorewarnings' :
#'file' : file contents
#'enablechunks'
#'chunksessionkey',
#'chunk'
#'done'
#'url' : self.url,
#'httpstatus'
'sessionkey' : session_key
}
data3 = query.GetData(params3, self.targetSite, useAPI = True,
encodeTitle = False)
print data3
The output:
# Edit token:
840b5c209660523709ecf8c0bfc06388+\
# Params2:
{'comment': u'\ufeff{{Information\n|Description=\xa9 Rubenstein, photographer
Ma
rtyna Borkowski
\n|Source=[http://www.flickr.com/photos/23357...@n03/2679181929/
Rubenstein Staff]\n|Date=2008-07-15
12:12\n|Author=[http://www.flickr.com/peopl
e/23357...@n03 Rubenstein]
\n|Permission=\n|other_versions=\n}}\n\n=={{int:licen
se}}==\n{{cc-by-2.0}}\n{{flickrreview|Multichill|{{subst:CURRENTYEAR}}-{{subst:C
URRENTMONTH}}-{{subst:CURRENTDAY2}}}}\n{{subst:unc}}', 'url':
'http://farm4.stat
ic.flickr.com/3040/2679181929_a677cd72d4_o.jpg', 'filename': u'Flickr -
Rubenste
in - Rubenstein_Staff.jpg', 'token': u'840b5c209660523709ecf8c0bfc06388+\\',
'ac
tion': 'upload', 'asyncdownload': 0}
#data2:
{u'upload': {u'upload_session_key': 1555467596}}
#data3:
{u'error': {u'info': u'Exception Caught: FSRepo::resolveVirtualUrl: unknown
protoocl', u'*': u"\n\n
#0
/home/wikipedia/common/wmf-deployment/includes/upload/UploadFromStash.php(40):
FSRepo->resolveVirtualUrl(NULL)\n
#1 /home/wikipedia/common/wmf-deployment/includes/api/ApiUpload.php(119):
UploadFromStash->initialize(NULL, Array)\n
#2 /home/wikipedia/common/wmf-deployment/includes/api/ApiMain.php(428):
ApiUpload->execute()\n
#3 /home/wikipedia/common/wmf-deployment/includes/api/ApiMain.php(248):
ApiMain->executeAction()\n
#4 /home/wikipedia/common/wmf-deployment/includes/api/ApiMain.php(232):
ApiMain->executeActionWithErrorHandling()\n
#5/home/wikipedia/common/wmf-deployment/api.php(116): ApiMain->execute()\n
#6 /usr/local/apache/common-local/live-1.5/api.php(3):
require('/home/wikipedia...')\n
#7 {main}\n\n", u'code': u'internal_api_error_MWException'}}
Might be related to
http://svn.wikimedia.org/viewvc/mediawiki/branches/wmf-deployment/includes/upload/UploadFromStash.php?r1=56438&r2=56557&pathrev=57490
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l