mirror of
https://github.com/armbian/build.git
synced 2026-09-08 23:59:54 +08:00
cli-flash: match image selectors as full fields, not substrings
The per-selector image filter used a loose substring test
(candidate == *"${token}"*). Image names are
VENDOR_VERSION_Board_release_branch_kver..., where Board/release/branch are
underscore-delimited middle fields, so a short release/branch (e.g. 'sid',
'edge') could match inside another field and keep the wrong image. Anchor each
selector to a complete _-delimited field (*"_${token}_"*). Empty selectors are
still skipped and the sequential board->release->branch narrowing is unchanged.
Signed-off-by: Igor Pecovnik <igor@armbian.com>
This commit is contained in:
@@ -68,7 +68,12 @@ function cli_flash() {
|
||||
fi
|
||||
declare -a kept=()
|
||||
for candidate in "${images[@]}"; do
|
||||
if [[ "${candidate##*/}" == *"${token}"* ]]; then
|
||||
# Match the selector as a complete underscore-delimited field, not
|
||||
# a loose substring: image names are
|
||||
# VENDOR_VERSION_Board_release_branch_kver..., where Board/release/
|
||||
# branch are all middle fields, so a short release/branch (e.g.
|
||||
# 'sid', 'edge') can't accidentally match inside another field.
|
||||
if [[ "${candidate##*/}" == *"_${token}_"* ]]; then
|
||||
kept+=("${candidate}")
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user