Skip to content

Commit

Permalink
fix(util): check that the name length is min of 1
Browse files Browse the repository at this point in the history
  • Loading branch information
atticusofsparta committed Jan 21, 2025
1 parent 5096f6a commit 5a0bfc5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/common/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ function utils.validateUndername(name)
--- max 61 chars
--- no starting dashes or underscores
--- alphanumeric, dashes, underscores OR one '@' sign
local validLength = #name <= constants.MAX_UNDERNAME_LENGTH

local validLength = #name <= constants.MAX_UNDERNAME_LENGTH and #name > 0
local validRegex = string.match(name, "^@$") ~= nil or string.match(name, "^[a-zA-Z0-9]+[a-zA-Z0-9_-]*$") ~= nil
local valid = validLength and validRegex
assert(valid, constants.UNDERNAME_DOES_NOT_EXIST_MESSAGE)
Expand Down

0 comments on commit 5a0bfc5

Please sign in to comment.