Skip to content

Commit

Permalink
Merge pull request #7816 from appwrite/fix-function-build
Browse files Browse the repository at this point in the history
Escape function build command
  • Loading branch information
abnegate committed Mar 13, 2024
2 parents 44a9aed + 3c8f517 commit f6fefd8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Appwrite/Platform/Workers/Builds.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ protected function buildDeployment(callable $getFunctionsDevice, Func $queueForF
]);

$command = $deployment->getAttribute('commands', '');
$command = \str_replace('"', '\\"', $command);

$response = null;
$err = null;
Expand All @@ -395,7 +394,7 @@ protected function buildDeployment(callable $getFunctionsDevice, Func $queueForF
Co\go(function () use ($executor, &$response, $project, $deployment, $source, $function, $runtime, $vars, $command, &$err) {
try {
$version = $function->getAttribute('version', 'v2');
$command = $version === 'v2' ? 'tar -zxf /tmp/code.tar.gz -C /usr/code && cd /usr/local/src/ && ./build.sh' : 'tar -zxf /tmp/code.tar.gz -C /mnt/code && helpers/build.sh "' . $command . '"';
$command = $version === 'v2' ? 'tar -zxf /tmp/code.tar.gz -C /usr/code && cd /usr/local/src/ && ./build.sh' : 'tar -zxf /tmp/code.tar.gz -C /mnt/code && helpers/build.sh "' . \trim(\escapeshellarg($command), "\'") . '"';

$response = $executor->createRuntime(
deploymentId: $deployment->getId(),
Expand Down

0 comments on commit f6fefd8

Please sign in to comment.