Skip to content

Commit

Permalink
[BUGFIX] Do not double escape path
Browse files Browse the repository at this point in the history
Resolves: #797
  • Loading branch information
simonschaufi committed Jan 13, 2025
1 parent 0f2a072 commit 3893b0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Task/Neos/Flow/CopyConfigurationTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}");
}
}

Expand Down
10 changes: 5 additions & 5 deletions tests/Unit/Task/Neos/Flow/CopyConfigurationTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/'");
}

/**
Expand All @@ -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/'");
}

/**
Expand All @@ -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:");
}
}

0 comments on commit 3893b0a

Please sign in to comment.