From 84d38211e27bb9b9effefa718f8c734db8adc5e1 Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Sat, 28 Mar 2020 09:52:49 +0900 Subject: [PATCH] Check if file size exceeds the max allowed --- entrypoint.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 1a0dcdd..f70aaf8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,6 +5,12 @@ IFS=$'\n\t' # Set the default path to README.md README_FILEPATH=${README_FILEPATH:="./README.md"} +# Check the file size +if [ $(wc -c <${README_FILEPATH}) -gt 25000 ]; then + echo "File size exceeds the maximum allowed 25000 bytes" + exit 1 +fi + # Acquire a token for the Docker Hub API echo "Acquiring token" LOGIN_PAYLOAD="{\"username\": \"${DOCKERHUB_USERNAME}\", \"password\": \"${DOCKERHUB_PASSWORD}\"}"