[backend/masto-client] Improve user lookup regex

This commit is contained in:
Laura Hausmann 2024-06-08 00:58:06 +02:00
parent 68528b6785
commit 33a3601a79
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -97,7 +97,7 @@ public class SearchController(
} }
var regex = new Regex var regex = new Regex
("^(?:@?(?<user>[a-zA-Z0-9_]+)@(?<host>[a-zA-Z0-9-.]+\\.[a-zA-Z0-9-]+))|(?:@(?<localuser>[a-zA-Z0-9_]+))$"); ("(?:^@?(?<user>[a-zA-Z0-9_]+)@(?<host>[a-zA-Z0-9-.]+\\.[a-zA-Z0-9-]+)$)|(?:^@(?<localuser>[a-zA-Z0-9_]+)$)");
var match = regex.Match(search.Query); var match = regex.Match(search.Query);
if (match.Success) if (match.Success)
{ {