mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(api): validate user_command name (#17004)
The name argument of nvim_add_user_command must begin with an uppercase character. Check that is does.
This commit is contained in:
parent
8d5288889a
commit
a34652ee84
@ -1387,6 +1387,11 @@ void add_user_command(String name, Object command, Dict(user_command) *opts, int
|
||||
LuaRef luaref = LUA_NOREF;
|
||||
LuaRef compl_luaref = LUA_NOREF;
|
||||
|
||||
if (mb_islower(name.data[0])) {
|
||||
api_set_error(err, kErrorTypeValidation, "'name' must begin with an uppercase letter");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (HAS_KEY(opts->range) && HAS_KEY(opts->count)) {
|
||||
api_set_error(err, kErrorTypeValidation, "'range' and 'count' are mutually exclusive");
|
||||
goto err;
|
||||
|
Loading…
Reference in New Issue
Block a user