X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmedia%2FSvgHandler.php;h=98c22a32dd769ec2b58da566465090636f27b64b;hb=fb04cc5a7ef629703535dccdaecd6fe02f203c81;hp=4d75d0444929375c8039644bc52dd74cdbab1a01;hpb=1ae3ebe82482b9244d1d9078cc36702116133f84;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/SvgHandler.php b/includes/media/SvgHandler.php index 4d75d04449..98c22a32dd 100644 --- a/includes/media/SvgHandler.php +++ b/includes/media/SvgHandler.php @@ -20,6 +20,8 @@ * @file * @ingroup Media */ + +use MediaWiki\Shell\Shell; use Wikimedia\ScopedCallback; /** @@ -335,11 +337,11 @@ class SvgHandler extends ImageHandler { // External command $cmd = str_replace( [ '$path/', '$width', '$height', '$input', '$output' ], - [ $wgSVGConverterPath ? wfEscapeShellArg( "$wgSVGConverterPath/" ) : "", + [ $wgSVGConverterPath ? Shell::escape( "$wgSVGConverterPath/" ) : "", intval( $width ), intval( $height ), - wfEscapeShellArg( $srcPath ), - wfEscapeShellArg( $dstPath ) ], + Shell::escape( $srcPath ), + Shell::escape( $dstPath ) ], $wgSVGConverters[$wgSVGConverter] ); @@ -379,7 +381,7 @@ class SvgHandler extends ImageHandler { * @param File|FSFile $file * @param string $path Unused * @param bool|array $metadata - * @return array + * @return array|false */ function getImageSize( $file, $path, $metadata = false ) { if ( $metadata === false && $file instanceof File ) { @@ -436,8 +438,10 @@ class SvgHandler extends ImageHandler { */ public function getMetadata( $file, $filename ) { $metadata = [ 'version' => self::SVG_METADATA_VERSION ]; + try { - $metadata += SVGMetadataExtractor::getMetadata( $filename ); + $svgReader = new SVGReader( $filename ); + $metadata += $svgReader->getMetadata(); } catch ( Exception $e ) { // @todo SVG specific exceptions // File not found, broken, etc. $metadata['error'] = [