[backend/masto-client] Fix /oauth/authorize when client id contains pluses

This commit is contained in:
Laura Hausmann 2024-01-31 22:17:23 +01:00
parent 8a64511f3a
commit c293a0bd3c
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -27,7 +27,7 @@ public class AuthorizeModel(DatabaseContext db) : PageModel {
public OauthToken? Token = null;
public async Task OnGet() {
App = await db.OauthApps.FirstOrDefaultAsync(p => p.ClientId == ClientId)
App = await db.OauthApps.FirstOrDefaultAsync(p => p.ClientId == ClientId.Replace(' ', '+'))
?? throw GracefulException.BadRequest("Invalid client_id");
if (MastodonOauthHelpers.ExpandScopes(Scopes).Except(MastodonOauthHelpers.ExpandScopes(App.Scopes)).Any())
throw GracefulException.BadRequest("Cannot request more scopes than app");