From: Roan Kattouw Date: Tue, 15 Jan 2008 21:09:44 +0000 (+0000) Subject: Limiting image history listings to 500 for now. A hard-coded limit sucks, but an... X-Git-Tag: 1.31.0-rc.0~49979 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=88b441f69a0efce44d4b13c4cda6437a2a4c6498;p=lhc%2Fweb%2Fwiklou.git Limiting image history listings to 500 for now. A hard-coded limit sucks, but an alternative isn't really available as the File handling code doesn't allow it (see also bug 12645). Besides, very few image histories are that long. --- diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index 7e7abeb6bd..778c5c694a 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -68,7 +68,13 @@ class ApiQueryImageInfo extends ApiQueryBase { $repository = $img->getRepoName(); $isCur = true; + $count = 0; while($line = $img->nextHistoryLine()) { // assignment + # FIXME: Limiting to 500 because it's unlimited right now + # 500+ image histories are scarce, but this has DoS potential + # FileRepo.php should be fixed + if($count++ == 500) + break; $row = get_object_vars( $line ); $vals = array(); $prefix = $isCur ? 'img' : 'oi';