muety / wakapi

📊 A minimalist, self-hosted WakaTime-compatible backend for coding statistics
https://wakapi.dev
MIT License
2.44k stars 149 forks source link

Disallow spaces in usernames #541

Closed jsbrain closed 9 months ago

jsbrain commented 9 months ago

Describe the bug In case the username has a space (e.g. 'Bob Jones'), a request to /compat/wakatime/v1/users/{user}/stats/{range} won't work. Other api endpoints do work, not sure if the bug only exists on this route or on others as well.

Screenshot 2023-10-24 at 15 38 42

System information Please provide information on:

jsbrain commented 9 months ago

Ok I actually changed the username in the db to remove the space. Still the same error, even for 'today' date range. So I guess the bug is caused by something else ...

muety commented 9 months ago

Thanks for reporting this! I think spaces in usernames are generally a bad idea, I'll probably disallow to have them.

Your error message, however, seems to relate to a permissions issue. Make sure your "Settings -> Permissions" settings allow to request the respective {range}.

jsbrain commented 9 months ago

Yeah I literally just realized that, after checking the differences between users in the database. Probably missed that setting after some update.

Classic operator error, sorry for the confusion :D

muety commented 9 months ago

Wait, how were you able to create a user with a name containing a white space? There is a check in place (since Feb '23) to prevent this :thinking:.

jsbrain commented 9 months ago

@muety I'm running wakapi since the very early days 😀

Amazing project, thanks a ton!