[backend/masto-client] Ignore App.website property when it only contains whitespace

This commit is contained in:
Laura Hausmann 2024-06-14 21:45:29 +02:00
parent a703b63876
commit c7bacc2856
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -53,10 +53,10 @@ public class AuthController(DatabaseContext db, MetaService meta) : ControllerBa
if (!MastodonOauthHelpers.ValidateScopes(request.Scopes)) if (!MastodonOauthHelpers.ValidateScopes(request.Scopes))
throw GracefulException.BadRequest("Invalid scopes parameter"); throw GracefulException.BadRequest("Invalid scopes parameter");
if (request.Website != null) if (!string.IsNullOrWhiteSpace(request.Website))
try try
{ {
var uri = new Uri(request.Website); var uri = new Uri(request.Website.Trim());
if (!uri.IsAbsoluteUri || uri.Scheme is not "http" and not "https") throw new Exception(); if (!uri.IsAbsoluteUri || uri.Scheme is not "http" and not "https") throw new Exception();
} }
catch catch