mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PageImages
synced 2024-11-15 12:00:40 +00:00
Make sure that thumbnail size is not overreported
Bug: 64661 Change-Id: Iece32c7875dc2e66f0f221649e7dc9c860451c07
This commit is contained in:
parent
8af8f1844c
commit
195615137e
|
@ -106,8 +106,11 @@ class ApiQueryPageImages extends ApiQueryBase {
|
|||
if ( $thumb && $thumb->getUrl() ) {
|
||||
$vals['thumbnail'] = array(
|
||||
'source' => wfExpandUrl( $thumb->getUrl(), PROTO_CURRENT ),
|
||||
'width' => $thumb->getWidth(),
|
||||
'height' => $thumb->getHeight()
|
||||
// You can request a thumb 1000x larger than the original which will return a Thumb
|
||||
// object that will lie about its size but have the original as an image.
|
||||
// Therefore, sanitize image size.
|
||||
'width' => min( $thumb->getWidth(), $file->getWidth() ),
|
||||
'height' => min( $thumb->getHeight(), $file->getHeight() ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue