Valid tags on a gallery should correspond to unordered list
authorArlo Breault <abreault@wikimedia.org>
Sat, 1 Apr 2017 13:59:21 +0000 (09:59 -0400)
committerArlo Breault <abreault@wikimedia.org>
Sat, 1 Apr 2017 13:59:21 +0000 (09:59 -0400)
 * This was introduced in 4d3446a8e3e when galleries were tables.
   However, in 05579cf0e60, it switched to ul's, but missed updating the
   sanitization.

 * As an example, the test shows that summary is currently wrongly
   permitted.

Change-Id: I8c52477dc65499d0c8a1ee5cc661a5f9ae78cc07

includes/parser/Parser.php
tests/parser/parserTests.txt

index 47d9a62..be4557d 100644 (file)
@@ -4975,7 +4975,7 @@ class Parser {
                $ig->setShowFilename( false );
                $ig->setParser( $this );
                $ig->setHideBadImages();
-               $ig->setAttributes( Sanitizer::validateTagAttributes( $params, 'table' ) );
+               $ig->setAttributes( Sanitizer::validateTagAttributes( $params, 'ul' ) );
 
                if ( isset( $params['showfilename'] ) ) {
                        $ig->setShowFilename( true );
index 2def875..3a31351 100644 (file)
@@ -19069,6 +19069,23 @@ title=[[Parser test]]
 !! end
 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
 
+!! test
+Gallery with valid attributes
+!! wikitext
+<gallery type="123" summary="345">
+File:File:Foobar.jpg
+</gallery>
+!! html/php
+<ul class="gallery mw-gallery-traditional" type="123">
+               <li class="gallerybox" style="width: 155px"><div style="width: 155px">
+                       <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
+                       <div class="gallerytext">
+                       </div>
+               </div></li>
+</ul>
+
+!! end
+
 ## Parsoid thinks the "centre" here is a property, not a caption.
 !! test
 Gallery