Skip to content

Commit fcaea94

Browse files
committed
fix version matching
1 parent e011bc7 commit fcaea94

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/dart/install.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ find_version_from_git_tags() {
2929
local repository=$2
3030
local prefix=${3:-"tags/v"}
3131
local separator=${4:-"."}
32-
local last_part_optional=${5:-"false"}
32+
local last_part_optional=${5:-""}
3333
if [ "$(echo "${requested_version}" | grep -o "." | wc -l)" != "2" ]; then
3434
local escaped_separator=${separator//./\\.}
3535
local last_part
36-
if [ "${last_part_optional}" != "false" ]; then
37-
last_part="(${escaped_separator}[0-9]+)*.*${last_part_optional}"
36+
if [ -n "${last_part_optional}" ]; then
37+
last_part=".*${last_part_optional}"
3838
else
39-
last_part="${escaped_separator}[0-9]+"
39+
last_part=""
4040
fi
41-
local regex="${prefix}\\K[0-9]+${escaped_separator}[0-9]+${last_part}$"
41+
local regex="${prefix}\\K[0-9]+${escaped_separator}[0-9]+(${escaped_separator}[0-9]+)*?${last_part}$"
4242
local version_list
4343
check_git
4444
check_packages ca-certificates
@@ -75,7 +75,7 @@ if [ "${CHANNEL}" = "main" ]; then
7575
URL="https://storage.googleapis.com/dart-archive/channels/be/raw/latest/sdk/dartsdk-linux-${SDK_ARCH}-release.zip"
7676
else
7777
if [ "${CHANNEL}" = "stable" ]; then
78-
LAST_PART="false"
78+
LAST_PART=""
7979
elif [ "${CHANNEL}" = "beta" ]; then
8080
LAST_PART="beta"
8181
elif [ "${CHANNEL}" = "dev" ]; then

0 commit comments

Comments
 (0)