Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/PHPExiftool/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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 {

/**
Expand All @@ -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;
Expand Down