jenkins-bot has submitted this change and it was merged. Change subject: thumb.php: support an optional "px" width suffix ......................................................................
thumb.php: support an optional "px" width suffix A large percentage (40-50%) of the 500s that are emitted in production are for a single URL, https://commons.wikimedia.org/w/thumb.php?f=Crystal_Clear_action_viewmag.png&width=21px The reason this fails is because thumb.php expects width to be "21", not "21px", and it currently tries to fetch (and generate) the "21pxpx" thumb size, which is obviously an invalid size. (an invalid size shouldn't result in a 5xx but rather to a 4xx. though; that's a separate bug that needs to be fixed). This URL is embedded by a gadget, Gadget-searchbox-js, that is copied in a lot of our wikis, including a big one, frwiki. mwgrep reveals that there are a bunch of other URLs in various Gadgets that have width values with "px" in them, so this presumably worked at some point in the past. While we could in theory fix all those URLs in these dozens of gadgets across wikis to not suffix width with "px", this sounds like a herculean effort and we're probably better off adding this compatibility branch to thumb.php that strips the "px" suffix, if existent. Change-Id: I3a00c9634b1c6af49fb8503cc3ff4cafdaff6b43 --- M thumb.php 1 file changed, 4 insertions(+), 0 deletions(-) Approvals: Reedy: Looks good to me, approved jenkins-bot: Verified diff --git a/thumb.php b/thumb.php index 59bf8dc..d7bf453 100644 --- a/thumb.php +++ b/thumb.php @@ -116,6 +116,10 @@ $params['width'] = $params['w']; unset( $params['w'] ); } + if ( isset( $params['width'] ) && substr( $params['width'], -2 ) == 'px' ) { + // strip the px (pixel) suffix, if found + $params['width'] = substr( $width, 0, strlen( $width ) - 2 ); + } if ( isset( $params['p'] ) ) { $params['page'] = $params['p']; } -- To view, visit https://gerrit.wikimedia.org/r/132809 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3a00c9634b1c6af49fb8503cc3ff4cafdaff6b43 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: wmf/1.24wmf3 Gerrit-Owner: Reedy <re...@wikimedia.org> Gerrit-Reviewer: Faidon Liambotis <fai...@wikimedia.org> Gerrit-Reviewer: Reedy <re...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits