Index: trunk/phase3/includes/api/ApiQueryFilearchive.php |
— | — | @@ -95,8 +95,14 @@ |
96 | 96 | |
97 | 97 | $sha1 = false; |
98 | 98 | if ( $sha1Set ) { |
| 99 | + if ( !ApiQueryAllimages::validateSha1Hash( $params['sha1'] ) ) { |
| 100 | + $this->dieUsage( 'The SHA1 hash provided is not valid', 'invalidsha1hash' ); |
| 101 | + } |
99 | 102 | $sha1 = wfBaseConvert( $params['sha1'], 16, 36, 31 ); |
100 | 103 | } elseif ( $sha1base36Set ) { |
| 104 | + if ( !ApiQueryAllimages::validateSha1Base36Hash( $sha1 ) ) { |
| 105 | + $this->dieUsage( 'The SHA1Base36 hash provided is not valid', 'invalidsha1base36hash' ); |
| 106 | + } |
101 | 107 | $sha1 = $params['sha1base36']; |
102 | 108 | } |
103 | 109 | if ( $sha1 ) { |
— | — | @@ -274,6 +280,8 @@ |
275 | 281 | return array_merge( parent::getPossibleErrors(), array( |
276 | 282 | array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted file information' ), |
277 | 283 | array( 'code' => 'hashsearchdisabled', 'info' => 'Search by hash disabled in Miser Mode' ), |
| 284 | + array( 'code' => 'invalidsha1hash', 'info' => 'The SHA1 hash provided is not valid' ), |
| 285 | + array( 'code' => 'invalidsha1base36hash', 'info' => 'The SHA1Base36 hash provided is not valid' ), |
278 | 286 | ) ); |
279 | 287 | } |
280 | 288 | |