mirror of
https://github.com/neovim/neovim.git
synced 2025-09-08 12:28:18 +00: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:
@@ -1387,6 +1387,11 @@ void add_user_command(String name, Object command, Dict(user_command) *opts, int
|
|||||||
LuaRef luaref = LUA_NOREF;
|
LuaRef luaref = LUA_NOREF;
|
||||||
LuaRef compl_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)) {
|
if (HAS_KEY(opts->range) && HAS_KEY(opts->count)) {
|
||||||
api_set_error(err, kErrorTypeValidation, "'range' and 'count' are mutually exclusive");
|
api_set_error(err, kErrorTypeValidation, "'range' and 'count' are mutually exclusive");
|
||||||
goto err;
|
goto err;
|
||||||
|
Reference in New Issue
Block a user