navidrome/navidrome

Incorrect case in username in Subsonic API causes failure creating new player

srichter opened this issue · 2 comments

If the username sent via the Subsonic API does not match the case of the username in the database, the user will successfully authenticate, but a new player will fail to be created.

The username in the context is set directly from the query string. This context value is what is used when creating a new player, however the player table has a foreign key constraint to the users table on username. If the case does not match, this constraint will fail.

The easy fix is to have the player registration method pull the username from the user stored in the context. A better fix might be to update the username stored in the context directly from the user model that is fetched from the database, but I am unsure if this will have any unintentional side effects when other methods will now see a "different" user based on case

I think the best option is avoid using the username as a foreign key. I'll try to fix this mess soon. Thanks for the report!

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Navidrome team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.