jenkins-bot has submitted this change and it was merged. Change subject: Make validation for page more strict on tiff to take only numbers ......................................................................
Make validation for page more strict on tiff to take only numbers This change causes wiki syntax like [[File:Foo.tiff|thumb|Page 7 of document]] to be interpreted as a caption instead, of saying select page 7 of the tiff. Previously it eventually ran intval( '7 of document' ), so flipped to page 7. Only possible downside I could see is this would cause things like left-to-right marks and weird unicode spaces to no longer be ignored. I don't think that's a big deal. Change-Id: I4760df0a230affb3189ca9b5f3f9f4cc76292b97 --- M PagedTiffHandler_body.php 1 file changed, 6 insertions(+), 0 deletions(-) Approvals: Aaron Schulz: Looks good to me, approved jenkins-bot: Verified diff --git a/PagedTiffHandler_body.php b/PagedTiffHandler_body.php index a12206e..f20290e 100644 --- a/PagedTiffHandler_body.php +++ b/PagedTiffHandler_body.php @@ -145,6 +145,12 @@ */ function validateParam( $name, $value ) { if ( in_array( $name, array( 'width', 'height', 'page', 'lossy' ) ) ) { + if ( $name === 'page' && trim( $value ) !== (string) intval( $value ) ) { + // Extra junk on the end of page, probably actually a caption + // e.g. [[File:Foo.tiff|thumb|Page 3 of the document shows foo]] + return false; + } + if ( $name == 'lossy' ) { # NOTE: make sure to use === for comparison. in PHP, '' == 0 and 'foo' == 1. -- To view, visit https://gerrit.wikimedia.org/r/133401 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4760df0a230affb3189ca9b5f3f9f4cc76292b97 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PagedTiffHandler Gerrit-Branch: master Gerrit-Owner: Brian Wolff <bawolff...@gmail.com> Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: Gilles <gdu...@wikimedia.org> Gerrit-Reviewer: MarkTraceur <mtrac...@member.fsf.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits