Skip to content

Commit

Permalink
Fixed bin/grav install command with arbitrary destination folder name
Browse files Browse the repository at this point in the history
  • Loading branch information
mahagr committed Jun 13, 2022
1 parent f315412 commit de4af5d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@
1. [](#bugfix)
* Regression: Fixed saving page with a new language causing cache corruption [getgrav/grav-plugin-admin#2282](https://github.com/getgrav/grav-plugin-admin/issues/2282)
* Fixed a potential fatal error when using watermark in images
* Fixed `bin/grav install` command with arbitrary destination folder name

# v1.7.33
## 04/25/2022
Expand Down
2 changes: 1 addition & 1 deletion system/src/Grav/Console/Cli/InstallCommand.php
Expand Up @@ -147,7 +147,7 @@ private function gitclone(): int
foreach ($this->config['git'] as $repo => $data) {
$path = $this->destination . DS . $data['path'];
if (!file_exists($path)) {
exec('cd "' . $this->destination . '" && git clone -b ' . $data['branch'] . ' --depth 1 ' . $data['url'] . ' ' . $data['path'], $output, $return);
exec('cd ' . escapeshellarg($this->destination) . ' && git clone -b ' . $data['branch'] . ' --depth 1 ' . $data['url'] . ' ' . $data['path'], $output, $return);

if (!$return) {
$io->writeln('<green>SUCCESS</green> cloned <magenta>' . $data['url'] . '</magenta> -> <cyan>' . $path . '</cyan>');
Expand Down
2 changes: 1 addition & 1 deletion system/src/Grav/Console/ConsoleTrait.php
Expand Up @@ -288,7 +288,7 @@ public function composerUpdate($path, $action = 'install')
{
$composer = Composer::getComposerExecutor();

return system($composer . ' --working-dir="'.$path.'" --no-interaction --no-dev --prefer-dist -o '. $action);
return system($composer . ' --working-dir=' . escapeshellarg($path) . ' --no-interaction --no-dev --prefer-dist -o '. $action);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion system/src/Grav/Console/Gpm/InstallCommand.php
Expand Up @@ -485,7 +485,7 @@ private function processSymlink(Package $package): void
{
$io = $this->getIO();

exec('cd ' . $this->destination);
exec('cd ' . escapeshellarg($this->destination));

$to = $this->destination . DS . $package->install_path;
$from = $this->getSymlinkSource($package);
Expand Down

0 comments on commit de4af5d

Please sign in to comment.