modrinth / labrinth

Our Rust-based backend utilizing the actix-web framework to serve Modrinth's API.
https://modrinth.com
GNU Affero General Public License v3.0
509 stars 73 forks source link

PATCH to /team/:id/members/:user fails when used with username rather than ID #910

Open brawaru opened 2 months ago

brawaru commented 2 months ago

Describe the bug

According to the documentation, the PATCH team/:id/members/:user endpoint should accept both the user ID and username for the :user pathname parameter ^1. However, when called with the username, the endpoint will return 401 (Unauthorized) with the error message telling that the current user has no permissions to edit the team, despite being a literal owner of the project.

Steps to reproduce

  1. Send a PATCH request to team/:id/members/:user with the username as a :user pathname parameter.

Expected behavior

The response succeeds and the member gets changed, just like it does when the user ID used instead.

Additional context

N/A