From 7273d0e1177c70ee45fe8049459e70ef574515a6 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 13 Mar 2024 01:03:51 +0100 Subject: [PATCH] Escape function build command The extra trim is neded to because the extra quotes interfere with additional operations in the executor/orchestration library. --- src/Appwrite/Platform/Workers/Builds.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Builds.php b/src/Appwrite/Platform/Workers/Builds.php index 42cd910a1..8a25980bc 100644 --- a/src/Appwrite/Platform/Workers/Builds.php +++ b/src/Appwrite/Platform/Workers/Builds.php @@ -394,7 +394,6 @@ class Builds extends Action ]); $command = $deployment->getAttribute('commands', ''); - $command = \str_replace('"', '\\"', $command); $response = null; $err = null; @@ -403,7 +402,7 @@ class Builds extends Action 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(),