cssText after DOM insertion.
* (bug 30711) When adding a new section to a page with section=new, the text is
now always added to the current version of the page
-* (bug 31719) Recognize &ns_svg; as the svg namespace when extracting width
+* (bug 31719) Fix uploads of SVGs exported by Adobe Illustrator by expanding
+ XML entities correctly.
* (bug 30914) Embeddable ResourceLoader modules (user.options, user.tokens)
should be loaded in <head> for proper dependency resolution
* (bug 32702) Removed method Skin::makeGlobalVariablesScript() has been readded
const DEFAULT_WIDTH = 512;
const DEFAULT_HEIGHT = 512;
const NS_SVG = 'http://www.w3.org/2000/svg';
- const ADOBE_SVG_ENTITY = '&ns_svg;';
private $reader = null;
private $mDebug = false;
$this->reader->open( $source, null, LIBXML_NOERROR | LIBXML_NOWARNING );
}
+ // Expand entities, since Adobe Illustrator uses them for xmlns
+ // attributes (bug 31719). Note that libxml2 has some protection
+ // against large recursive entity expansions so this is not as
+ // insecure as it might appear to be.
+ $this->reader->setParserProperty( XMLReader::SUBST_ENTITIES, true );
+
$this->metadata['width'] = self::DEFAULT_WIDTH;
$this->metadata['height'] = self::DEFAULT_HEIGHT;
$keepReading = $this->reader->read();
}
- # Note, entities not expanded in namespaceURI - bug 31719
- if ( $this->reader->localName != 'svg' ||
- ( $this->reader->namespaceURI != self::NS_SVG &&
- $this->reader->namespaceURI != self::ADOBE_SVG_ENTITY ) ) {
+ if ( $this->reader->localName != 'svg' || $this->reader->namespaceURI != self::NS_SVG ) {
throw new MWException( "Expected <svg> tag, got ".
$this->reader->localName . " in NS " . $this->reader->namespaceURI );
}