From 424b1c3829ab85ea1a328784957a0f9347ba3d0e Mon Sep 17 00:00:00 2001 From: Gray Mackall <34871572+gmackall@users.noreply.github.com> Date: Thu, 24 Aug 2023 16:43:05 -0400 Subject: [PATCH] Add case checking to android sdk cipd upload script (flutter/engine#45063) See https://github.com/flutter/flutter/pull/131901#issuecomment-1690252455 for the reason for this PR. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../flutter/tools/android_sdk/create_cipd_packages.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/tools/android_sdk/create_cipd_packages.sh b/engine/src/flutter/tools/android_sdk/create_cipd_packages.sh index 8b6565b16e..2887cc1679 100755 --- a/engine/src/flutter/tools/android_sdk/create_cipd_packages.sh +++ b/engine/src/flutter/tools/android_sdk/create_cipd_packages.sh @@ -6,7 +6,8 @@ print_usage () { echo "Usage:" echo " ./create_cipd_packages.sh [PATH_TO_SDK_DIR]" echo " Downloads, packages, and uploads Android SDK packages where:" - echo " - VERSION_TAG is the tag of the cipd packages, e.g. 28r6 or 31v1" + echo " - VERSION_TAG is the tag of the cipd packages, e.g. 28r6 or 31v1. Must contain" + echo " only lowercase letters and numbers." echo " - PATH_TO_SDK_DIR is the path to the sdk folder. If omitted, this defaults to" echo " your ANDROID_SDK_ROOT environment variable." echo " ./create_cipd_packages.sh list" @@ -31,6 +32,13 @@ if [[ $1 == "" ]]; then exit 1 fi +#Validate version contains only lower case letters and numbers +if ! [[ $1 =~ ^[[:lower:][:digit:]]+$ ]]; then + echo "Version tag can only consist of lower case letters and digits."; + print_usage + exit 1 +fi + # Validate path contains depot_tools if [[ `which cipd` == "" ]]; then echo "'cipd' command not found. depot_tools should be on the path."