summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe lemons <citrons@mondecitronne.com>2023-04-09 20:36:59 -0500
committerthe lemons <citrons@mondecitronne.com>2023-04-09 20:36:59 -0500
commita9547dcdea6323650fb6c31e0d5ef2fdc01579b8 (patch)
treeeb336e6ce9fdcf27149e3a1b0dbd98eaa9df2e20
parentc38a2b99de77abeb9e1adfa753a35903c8195f6f (diff)
return nil upon invalid UIDHEADmaster
-rw-r--r--auth.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/auth.lua b/auth.lua
index 978fbc4..2a97ab4 100644
--- a/auth.lua
+++ b/auth.lua
@@ -142,8 +142,9 @@ function M.user(uid)
end
function M:get_data()
- assert(
- type(self.uid) == 'string' and self.uid:match '^%w+$', "invalid uid")
+ if type(self.uid) ~= 'string' or not self.uid:match '^%w+$' then
+ return nil
+ end
local cached, data = cache_get('users', self.uid)
if cached then return data end
data = api_get('/api/user/'..self.uid)