Fixed bin/grav install command with arbitrary destination folder name

This commit is contained in:
Matias Griese
2022-06-13 20:38:16 +03:00
parent f31541250f
commit de4af5dbcc
4 changed files with 4 additions and 3 deletions

View File

@@ -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

View File

@@ -147,7 +147,7 @@ class InstallCommand extends GravCommand
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>');

View File

@@ -288,7 +288,7 @@ trait ConsoleTrait
{
$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);
}
/**

View File

@@ -485,7 +485,7 @@ class InstallCommand extends GpmCommand
{
$io = $this->getIO();
exec('cd ' . $this->destination);
exec('cd ' . escapeshellarg($this->destination));
$to = $this->destination . DS . $package->install_path;
$from = $this->getSymlinkSource($package);