From b94b4c1315ba065fe82508b29297b1480dce935b Mon Sep 17 00:00:00 2001 From: Simon Schaufelberger Date: Fri, 10 Jan 2025 12:31:30 +0100 Subject: [PATCH] [BUGFIX] Do not double escape path Resolves: #797 --- src/Task/Neos/Flow/CopyConfigurationTask.php | 2 +- .../Unit/Task/Neos/Flow/CopyConfigurationTaskTest.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Task/Neos/Flow/CopyConfigurationTask.php b/src/Task/Neos/Flow/CopyConfigurationTask.php index cbd0f713..d02f15ec 100644 --- a/src/Task/Neos/Flow/CopyConfigurationTask.php +++ b/src/Task/Neos/Flow/CopyConfigurationTask.php @@ -75,7 +75,7 @@ public function execute(Node $node, Application $application, Deployment $deploy } $createDirectoryCommand = '"mkdir -p ' . $escapedTargetPath . '"'; $commands[] = ltrim("{$expect} ssh {$sshOptions}{$sshPort}{$username}{$hostname} {$createDirectoryCommand}"); - $commands[] = ltrim("{$expect} scp {$sshOptions}{$scpPort}{$escapedSourcePath} {$username}{$hostname}:\"{$escapedTargetPath}\""); + $commands[] = ltrim("{$expect} scp {$sshOptions}{$scpPort}{$escapedSourcePath} {$username}{$hostname}:{$escapedTargetPath}"); } } diff --git a/tests/Unit/Task/Neos/Flow/CopyConfigurationTaskTest.php b/tests/Unit/Task/Neos/Flow/CopyConfigurationTaskTest.php index 8f5d317c..c0df6087 100644 --- a/tests/Unit/Task/Neos/Flow/CopyConfigurationTaskTest.php +++ b/tests/Unit/Task/Neos/Flow/CopyConfigurationTaskTest.php @@ -93,9 +93,9 @@ public function executeOnRemoteHostFindsConfigurationRecursively(): void $releasesPath = $this->deployment->getApplicationReleasePath($this->node); $this->assertCommandExecuted("ssh remote \"mkdir -p '{$releasesPath}/Configuration/'\""); - $this->assertCommandExecuted("scp '{$configPath}/Settings.yaml' remote:\"'{$releasesPath}/Configuration/'\""); + $this->assertCommandExecuted("scp '{$configPath}/Settings.yaml' remote:'{$releasesPath}/Configuration/'"); $this->assertCommandExecuted("ssh remote \"mkdir -p '{$releasesPath}/Configuration/Production/'\""); - $this->assertCommandExecuted("scp '{$configPath}/Production/Settings.yaml' remote:\"'{$releasesPath}/Configuration/Production/'\""); + $this->assertCommandExecuted("scp '{$configPath}/Production/Settings.yaml' remote:'{$releasesPath}/Configuration/Production/'"); } /** @@ -115,9 +115,9 @@ public function executeOnRemoteHostFindsConfigurationRecursivelyWithSSHPassword( $releasesPath = $this->deployment->getApplicationReleasePath($this->node); $this->assertCommandExecuted("ssh -o PubkeyAuthentication=no remote \"mkdir -p '{$releasesPath}/Configuration/'\""); - $this->assertCommandExecuted("scp -o PubkeyAuthentication=no '{$configPath}/Settings.yaml' remote:\"'{$releasesPath}/Configuration/'\""); + $this->assertCommandExecuted("scp -o PubkeyAuthentication=no '{$configPath}/Settings.yaml' remote:'{$releasesPath}/Configuration/'"); $this->assertCommandExecuted("ssh -o PubkeyAuthentication=no remote \"mkdir -p '{$releasesPath}/Configuration/Production/'\""); - $this->assertCommandExecuted("scp -o PubkeyAuthentication=no '{$configPath}/Production/Settings.yaml' remote:\"'{$releasesPath}/Configuration/Production/'\""); + $this->assertCommandExecuted("scp -o PubkeyAuthentication=no '{$configPath}/Production/Settings.yaml' remote:'{$releasesPath}/Configuration/Production/'"); } /** @@ -138,6 +138,6 @@ public function executeOnRemoteHostCorrectlyAppliesSshOptions(): void $this->assertCommandExecuted("ssh -p '22' foo@remote \""); $this->assertCommandExecuted("scp -P '22'"); - $this->assertCommandExecuted("' foo@remote:\""); + $this->assertCommandExecuted("' foo@remote:"); } }