Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -197,7 +197,8 @@ |
198 | 198 | cssText after DOM insertion. |
199 | 199 | * (bug 30711) When adding a new section to a page with section=new, the text is |
200 | 200 | now always added to the current version of the page |
201 | | -* (bug 31719) Recognize &ns_svg; as the svg namespace when extracting width |
| 201 | +* (bug 31719) Fix uploads of SVGs exported by Adobe Illustrator by expanding |
| 202 | + XML entities correctly. |
202 | 203 | * (bug 30914) Embeddable ResourceLoader modules (user.options, user.tokens) |
203 | 204 | should be loaded in <head> for proper dependency resolution |
204 | 205 | * (bug 32702) Removed method Skin::makeGlobalVariablesScript() has been readded |
Index: trunk/phase3/includes/media/SVGMetadataExtractor.php |
— | — | @@ -36,7 +36,6 @@ |
37 | 37 | const DEFAULT_WIDTH = 512; |
38 | 38 | const DEFAULT_HEIGHT = 512; |
39 | 39 | const NS_SVG = 'http://www.w3.org/2000/svg'; |
40 | | - const ADOBE_SVG_ENTITY = '&ns_svg;'; |
41 | 40 | |
42 | 41 | private $reader = null; |
43 | 42 | private $mDebug = false; |
— | — | @@ -69,6 +68,12 @@ |
70 | 69 | $this->reader->open( $source, null, LIBXML_NOERROR | LIBXML_NOWARNING ); |
71 | 70 | } |
72 | 71 | |
| 72 | + // Expand entities, since Adobe Illustrator uses them for xmlns |
| 73 | + // attributes (bug 31719). Note that libxml2 has some protection |
| 74 | + // against large recursive entity expansions so this is not as |
| 75 | + // insecure as it might appear to be. |
| 76 | + $this->reader->setParserProperty( XMLReader::SUBST_ENTITIES, true ); |
| 77 | + |
73 | 78 | $this->metadata['width'] = self::DEFAULT_WIDTH; |
74 | 79 | $this->metadata['height'] = self::DEFAULT_HEIGHT; |
75 | 80 | |
— | — | @@ -103,10 +108,7 @@ |
104 | 109 | $keepReading = $this->reader->read(); |
105 | 110 | } |
106 | 111 | |
107 | | - # Note, entities not expanded in namespaceURI - bug 31719 |
108 | | - if ( $this->reader->localName != 'svg' || |
109 | | - ( $this->reader->namespaceURI != self::NS_SVG && |
110 | | - $this->reader->namespaceURI != self::ADOBE_SVG_ENTITY ) ) { |
| 112 | + if ( $this->reader->localName != 'svg' || $this->reader->namespaceURI != self::NS_SVG ) { |
111 | 113 | throw new MWException( "Expected <svg> tag, got ". |
112 | 114 | $this->reader->localName . " in NS " . $this->reader->namespaceURI ); |
113 | 115 | } |