diff --git a/entrypoint.sh b/entrypoint.sh index 5115058..4359911 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -116,13 +116,17 @@ main() { # Iterate over $INPUT_SOURCE multiline string and run aws s3 $COMMAND while IFS= read -r source; do - if [ "$COMMAND" == "cp" ] || [ "$COMMAND" == "mv" ] || [ "$COMMAND" == "sync" ] - then - echo "aws s3 $COMMAND \"$source\" $INPUT_DESTINATION $INPUT_FLAGS" - aws s3 "$COMMAND" "$source" "$INPUT_DESTINATION" "$INPUT_FLAGS" + if [ -n "$source" ]; then + if [ "$COMMAND" == "cp" ] || [ "$COMMAND" == "mv" ] || [ "$COMMAND" == "sync" ] + then + echo "aws s3 $COMMAND \"$source\" $INPUT_DESTINATION $INPUT_FLAGS" + aws s3 "$COMMAND" "$source" "$INPUT_DESTINATION" "$INPUT_FLAGS" + else + echo "aws s3 $COMMAND \"$source\" $INPUT_FLAGS" + aws s3 "$COMMAND" "$source" "$INPUT_FLAGS" + fi else - echo "aws s3 $COMMAND \"$source\" $INPUT_FLAGS" - aws s3 "$COMMAND" "$source" "$INPUT_FLAGS" + echo "Source is empty, skipping AWS S3 command." fi done <<< "$INPUT_SOURCE" }