Skip to content

Commit 95d4388

Browse files
committed
fix: cli path issue
1 parent e00aec1 commit 95d4388

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

templates/cli/app/services/service.php.twig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ $cli
6262
{% endif %}
6363
{% for parameter in method.parameters.body %}
6464
{% if parameter.type == 'file' and method.packaging %}
65+
${{ parameter.name | caseCamel }} = \urldecode(${{ parameter.name | caseCamel }});
6566
$cloudFunctionPath = realpath(__DIR__.'/../../../files/'.${{ parameter.name | caseCamel }});
66-
$cloudFunctionParentDir = dirname($cloudFunctionPath, 1);
67-
$cloudFunctionDirName = basename($cloudFunctionPath);
67+
$cloudFunctionParentDir = escapeshellarg(dirname($cloudFunctionPath, 1));
68+
$cloudFunctionDirName = escapeshellarg(basename($cloudFunctionPath));
6869
if (file_exists($cloudFunctionPath) === false ) {
6970
throw new Exception("Path doesn't exist. Please ensure that the path is within the current directory. ");
7071
}
@@ -75,7 +76,7 @@ $cli
7576
$cFile = new \CURLFile($archivePath, 'application/x-gzip' , basename($archivePath));
7677
$params['{{ parameter.name }}'] = $cFile;
7778
{% elseif parameter.type == 'file' %}
78-
${{ parameter.name | caseCamel }} = realpath(__DIR__.'/../../../files/'.${{ parameter.name | caseCamel }});
79+
${{ parameter.name | caseCamel }} = realpath(__DIR__.'/../../../files/'.\urldecode(${{ parameter.name | caseCamel }}));
7980
if (file_exists(${{ parameter.name | caseCamel }}) === false ) {
8081
throw new Exception("Path doesn't exist. Please ensure that the path is within the current directory. ");
8182
}

templates/cli/install.sh.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ for x in "${@}" ; do
140140
_args=$_args" "$x
141141
done
142142
143-
bash -c "docker run -i --rm --volume {{ spec.title | lower }}-cli:/usr/local/code/app/.preferences/ --volume $(pwd):/usr/local/code/files:rw --network host '${{ spec.title | upper }}_CLI_IMAGE_NAME:${{ spec.title | upper }}_CLI_IMAGE_VERSION' $_args" ' > ${{ spec.title | upper }}_TEMP_NAME
143+
bash -c "docker run -i --rm --volume {{ spec.title | lower }}-cli:/usr/local/code/app/.preferences/ --volume \"$PWD\":/usr/local/code/files:rw --network host '${{ spec.title | upper }}_CLI_IMAGE_NAME:${{ spec.title | upper }}_CLI_IMAGE_VERSION' $_args" ' > ${{ spec.title | upper }}_TEMP_NAME
144144

145145
printf "${GREEN}🚧 Setting Permissions ${NC}\n"
146146
chmod +x ${{ spec.title | upper }}_TEMP_NAME

0 commit comments

Comments
 (0)