Last modified: 2013-04-22 16:15:47 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T45177, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 43177 - Regression: Api query by aisha1 stopped working
Regression: Api query by aisha1 stopped working
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.21.x
All All
: High major (vote)
: ---
Assigned To: Brad Jorsch
https://commons.wikimedia.org/w/api.p...
: code-update-regression
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-16 18:48 UTC by Maarten Dammers
Modified: 2013-04-22 16:15 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Maarten Dammers 2012-12-16 18:48:30 UTC
I wanted to upload some images and I noticed the function to check for duplicate files stopped working. 

When I do a manual query at https://commons.wikimedia.org/w/api.php?action=query&aisha1=4E2E2F6EC0CB4964875F2A045DB8531BC8E5ADD7&list=allimages&format=json

I get:

{

    "servedby": "srv299",
    "error": {
        "code": "aiinvalidsha1hash",
        "info": "The SHA1 hash provided is not valid"
    }

}

4E2E2F6EC0CB4964875F2A045DB8531BC8E5ADD7 is a valid sha1 hash generated by the follow python code:

hashObject = hashlib.sha1()
hashObject.update(self.downloadPhoto().getvalue())
base64.b16encode(hashObject.digest())

This used to work. Last successful upload was on the 14th of November (https://commons.wikimedia.org/wiki/Special:ListFiles/BotMultichillT). I looked at https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=history;f=includes/api/ApiQueryAllImages.php;h=e6a019460764383891284366d237a0a7c7043138;hb=HEAD and my assumption is that https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=commitdiff;h=529db96cdc31c5a1870ee0df623f21912a73c9aa caused this.
Comment 1 Jesús Martínez Novo (Ciencia Al Poder) 2012-12-16 20:01:32 UTC
Are you sure it is a valid SHA1 hash?

Retrieving the SHA1 with http://commons.wikimedia.org/w/api.php?action=query&list=allimages&aiprop=sha1&aifrom=A and then calling again with the same SHA1 http://commons.wikimedia.org/w/api.php?action=query&list=allimages&aisha1= (SHA appended here) works for me.
Comment 2 Maarten Dammers 2012-12-16 22:43:14 UTC
Yes, it's valid. Looks like the uppercase/lowercase is an issue here. Try taking a hash and change one letter to uppercase, it will give an error. As this is base16 encoded, bot lowercase and uppercase are correct and should be accepted.
Comment 3 Brad Jorsch 2012-12-16 22:53:52 UTC
This was broken in change Ic980fd71; apparently no one noticed that both users of validateSha1Hash pass the hash through wfBaseConvert which accepts both lower and uppercase letters.

Gerrit change I70493519 should fix it. In the mean time, a workaround is to use lowercase letters in the hash.
Comment 4 Maarten Dammers 2012-12-16 22:56:23 UTC
Yes, already applied the workaround to Pywikipedia, see http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10802
Comment 5 Jesús Martínez Novo (Ciencia Al Poder) 2012-12-17 20:12:31 UTC
Resolving bug. Gerrit change #39010 has been successfully merged into the git repository.

Thanks Brad!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links