From 9835b712a3c009c74f968220dd4737a0b3bf600d Mon Sep 17 00:00:00 2001 From: Jianhui Yuan Xu <107997665+NeumoNeumo@users.noreply.github.com> Date: Fri, 8 Sep 2023 20:47:29 +0800 Subject: [PATCH] Bug fixed: commas break the format in curl attachments When there's comma in the filename like "Brains, Minds, and Machines: Vision and Action.mp4", the `-F` flag in the bash is like ```bash -F "file=@Brains, Minds, and Machines: Vision and Action.mp4;filename=Brains, Minds, and Machines: Vision and Action.mp4" ``` The comma will split the information unexpectedly. We can add double quotes to fix this problem. --- client/plik.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/plik.sh b/client/plik.sh index 9c05ed8c..77b57e22 100755 --- a/client/plik.sh +++ b/client/plik.sh @@ -200,7 +200,7 @@ do if [ "$STDIN" == true ]; then UPLOAD_COMMAND+="curl -s -X POST $AUTH_TOKEN_HEADER $UPLOAD_TOKEN_HEADER -F \"file=@-;filename=$FILENAME\" $PLIK_URL/file/$UPLOAD_ID" else - UPLOAD_COMMAND+="curl -s -X POST $AUTH_TOKEN_HEADER $UPLOAD_TOKEN_HEADER -F \"file=@$FILE;filename=$FILENAME\" $PLIK_URL/file/$UPLOAD_ID" + UPLOAD_COMMAND+="curl -s -X POST $AUTH_TOKEN_HEADER $UPLOAD_TOKEN_HEADER -F \"file=@\\\"$FILE\\\";filename=\\\"$FILENAME\\\"\" $PLIK_URL/file/$UPLOAD_ID" fi FILE_RESP=$(eval $UPLOAD_COMMAND)