From b83d190120fd312e55085447f958f8263b44098a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Mami=C4=87?= Date: Sun, 29 Oct 2023 11:18:49 +0100 Subject: [PATCH] Double quotes around filenames, paths (#47) --- entrypoint.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 4f9b3b4..106f3da 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,7 +7,7 @@ printf "\n📦 Creating %s archive...\n" "$INPUT_TYPE" if [ "$INPUT_DIRECTORY" != "." ] then - cd $INPUT_DIRECTORY + cd "$INPUT_DIRECTORY" fi if [ "$INPUT_TYPE" = "zip" ] @@ -16,7 +16,7 @@ then then if [ -z "$INPUT_EXCLUSIONS" ] then - 7z a -tzip $INPUT_FILENAME $INPUT_PATH $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; } + 7z a -tzip "$INPUT_FILENAME" "$INPUT_PATH" $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; } else EXCLUSIONS='' @@ -32,21 +32,21 @@ then EXCLUSIONS+=$EXCLUSION done - 7z a -tzip $INPUT_FILENAME $INPUT_PATH $EXCLUSIONS $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; } + 7z a -tzip "$INPUT_FILENAME" "$INPUT_PATH" $EXCLUSIONS $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; } fi else - if [ -z "$INPUT_EXCLUSIONS" ] + if [ -z "$INPUT_EXCLUSIONS" ] then - zip -r $INPUT_FILENAME $INPUT_PATH $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; } + zip -r "$INPUT_FILENAME" "$INPUT_PATH" $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; } else - zip -r $INPUT_FILENAME $INPUT_PATH -x $INPUT_EXCLUSIONS $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; } + zip -r "$INPUT_FILENAME" "$INPUT_PATH" -x $INPUT_EXCLUSIONS $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; } fi fi elif [ "$INPUT_TYPE" = "tar" ] || [ "$INPUT_TYPE" = "tar.gz" ] then if [ -z "$INPUT_EXCLUSIONS" ] then - tar -zcvf $INPUT_FILENAME $INPUT_PATH $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; } + tar -zcvf "$INPUT_FILENAME" "$INPUT_PATH" $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; } else EXCLUSIONS='' @@ -56,7 +56,7 @@ then EXCLUSIONS+=$EXCLUSION done - tar $EXCLUSIONS -zcvf $INPUT_FILENAME $INPUT_PATH $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; } + tar $EXCLUSIONS -zcvf "$INPUT_FILENAME" "$INPUT_PATH" $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; } fi else printf "\n⛔ Invalid archiving tool.\n"; exit 1;