Skip to content

Commit f449070

Browse files
truett-davisljharb
authored andcommitted
check for known alias and proper prefixing
1 parent 0fbe3a6 commit f449070

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

nvm.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,6 +1591,11 @@ nvm_ls_remote() {
15911591
fi
15921592
PATTERN="$(NVM_LTS="${NVM_LTS-}" nvm_ls_remote "${IMPLICIT}" | command tail -1 | command awk '{ print $1 }')"
15931593
elif [ -n "${PATTERN}" ]; then
1594+
# Check if PATTERN is a known LTS name without lts/ prefix
1595+
if [ -f "$(nvm_alias_path)/lts/$(echo "${PATTERN}" | tr '[:upper:]' '[:lower:]')" ]; then
1596+
nvm_err "LTS names must be prefixed with 'lts/'. Use 'lts/${PATTERN}' instead."
1597+
return 3
1598+
fi
15941599
PATTERN="$(nvm_ensure_version_prefix "${PATTERN}")"
15951600
else
15961601
PATTERN=".*"

0 commit comments

Comments
 (0)