From a60ed02b64a410fe84effe679e68d03f579a0f05 Mon Sep 17 00:00:00 2001 From: Pierre Hennequart Date: Wed, 12 Apr 2017 06:37:19 +0200 Subject: [PATCH 1/3] escape filenames in shell --- lib/PHPExiftool/Writer.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/PHPExiftool/Writer.php b/lib/PHPExiftool/Writer.php index 7200b0072..31a64eb6e 100644 --- a/lib/PHPExiftool/Writer.php +++ b/lib/PHPExiftool/Writer.php @@ -174,7 +174,7 @@ public function write($file, MetadataBag $metadatas, $destination = null) * anything else. */ if (! $destination) { - $command .= ' -all:all= ' . ($this->eraseProfile ? '' : '--icc_profile:all ') . '' . $file . ' -execute'; + $command .= ' -all:all= ' . ($this->eraseProfile ? '' : '--icc_profile:all ') . '' . escapeshellarg($file) . ' -execute'; /** * If no destination, all commands will overwrite in place @@ -187,7 +187,7 @@ public function write($file, MetadataBag $metadatas, $destination = null) * If destination was specified, we start by creating the blank * destination, we will write in it at next step */ - $command .= ' -all:all= ' . ($this->eraseProfile ? '' : '--icc_profile:all ') . '-o ' . $destination . ' ' . $file . ' -execute'; + $command .= ' -all:all= ' . ($this->eraseProfile ? '' : '--icc_profile:all ') . '-o ' . escapeshellarg($destination) . ' ' . escapeshellarg($file) . ' -execute'; $file = $destination; $destination = null; @@ -197,7 +197,7 @@ public function write($file, MetadataBag $metadatas, $destination = null) $command .= $this->addMetadatasArg($metadatas); if ($destination) { - $command .= ' -o ' . escapeshellarg($destination) . ' ' . $file; + $command .= ' -o ' . escapeshellarg($destination) . ' ' . escapeshellarg($file); } else { /** @@ -207,11 +207,11 @@ public function write($file, MetadataBag $metadatas, $destination = null) * option. For these systems, the -overwrite_original_in_place option * may be used to preserve the creation date. */ - $command .= ' -overwrite_original_in_place ' . $file; + $command .= ' -overwrite_original_in_place ' . escapeshellarg($file); } if ('' !== $syncCommand = $this->getSyncCommand()) { - $command .= ' -execute -overwrite_original_in_place ' . $syncCommand . ' ' . $file; + $command .= ' -execute -overwrite_original_in_place ' . $syncCommand . ' ' . escapeshellarg($file); } $command .= ' -common_args' . $common_args; From 15dbe1c96bfb7fe80aec281c7b486339a0e4350b Mon Sep 17 00:00:00 2001 From: Pierre Hennequart Date: Wed, 12 Apr 2017 06:38:45 +0200 Subject: [PATCH 2/3] remove file having invalid name case --- .../Driver/Tag/ID3v23/PictureMimeType.php | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 lib/PHPExiftool/Driver/Tag/ID3v23/PictureMimeType.php diff --git a/lib/PHPExiftool/Driver/Tag/ID3v23/PictureMimeType.php b/lib/PHPExiftool/Driver/Tag/ID3v23/PictureMimeType.php deleted file mode 100644 index 66ea644eb..000000000 --- a/lib/PHPExiftool/Driver/Tag/ID3v23/PictureMimeType.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace PHPExiftool\Driver\Tag\ID3v23; - -use JMS\Serializer\Annotation\ExclusionPolicy; -use PHPExiftool\Driver\AbstractTag; - -/** - * @ExclusionPolicy("all") - */ -class PictureMIMEType extends AbstractTag -{ - - protected $Id = 'APIC-1'; - - protected $Name = 'PictureMIMEType'; - - protected $FullName = 'ID3::v2_3'; - - protected $GroupName = 'ID3v2_3'; - - protected $g0 = 'ID3'; - - protected $g1 = 'ID3v2_3'; - - protected $g2 = 'Audio'; - - protected $Type = '?'; - - protected $Writable = false; - - protected $Description = 'Picture MIME Type'; - - protected $local_g2 = 'Image'; -} From e99bc5d9953eb91cc0c49fb30f1ff1163cf599fe Mon Sep 17 00:00:00 2001 From: Pierre Hennequart Date: Wed, 12 Apr 2017 06:39:06 +0200 Subject: [PATCH 3/3] restore file with valid name case --- .../Driver/Tag/ID3v23/PictureMIMEType.php | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 lib/PHPExiftool/Driver/Tag/ID3v23/PictureMIMEType.php diff --git a/lib/PHPExiftool/Driver/Tag/ID3v23/PictureMIMEType.php b/lib/PHPExiftool/Driver/Tag/ID3v23/PictureMIMEType.php new file mode 100644 index 000000000..66ea644eb --- /dev/null +++ b/lib/PHPExiftool/Driver/Tag/ID3v23/PictureMIMEType.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PHPExiftool\Driver\Tag\ID3v23; + +use JMS\Serializer\Annotation\ExclusionPolicy; +use PHPExiftool\Driver\AbstractTag; + +/** + * @ExclusionPolicy("all") + */ +class PictureMIMEType extends AbstractTag +{ + + protected $Id = 'APIC-1'; + + protected $Name = 'PictureMIMEType'; + + protected $FullName = 'ID3::v2_3'; + + protected $GroupName = 'ID3v2_3'; + + protected $g0 = 'ID3'; + + protected $g1 = 'ID3v2_3'; + + protected $g2 = 'Audio'; + + protected $Type = '?'; + + protected $Writable = false; + + protected $Description = 'Picture MIME Type'; + + protected $local_g2 = 'Image'; +}