Page MenuHomePhabricator

Regression: Api query by aisha1 stopped working
Closed, ResolvedPublic


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

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()

This used to work. Last successful upload was on the 14th of November ( I looked at;a=history;f=includes/api/ApiQueryAllImages.php;h=e6a019460764383891284366d237a0a7c7043138;hb=HEAD and my assumption is that;a=commitdiff;h=529db96cdc31c5a1870ee0df623f21912a73c9aa caused this.

Version: 1.21.x
Severity: major



Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 12:50 AM
bzimport set Reference to bz43177.

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.

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.

Resolving bug. Gerrit change 39010 has been successfully merged into the git repository.

Thanks Brad!