Change username regex in webfinger (#34)
* Change username regex in webfinger Changes the regex used for username in `extract_webfinger_name` to include additional characters like '.' and '-'. This is the same regex used in Mastodon. * Add link to Mastodon regex
This commit is contained in:
parent
c56f526914
commit
813d7943e1
1 changed files with 7 additions and 2 deletions
|
@ -71,7 +71,12 @@ where
|
||||||
T: Clone,
|
T: Clone,
|
||||||
{
|
{
|
||||||
// TODO: would be nice if we could implement this without regex and remove the dependency
|
// TODO: would be nice if we could implement this without regex and remove the dependency
|
||||||
let regex = Regex::new(&format!("^acct:([a-zA-Z0-9_]{{3,}})@{}$", data.domain()))
|
// Regex taken from Mastodon -
|
||||||
|
// https://github.com/mastodon/mastodon/blob/2b113764117c9ab98875141bcf1758ba8be58173/app/models/account.rb#L65
|
||||||
|
let regex = Regex::new(&format!(
|
||||||
|
"^acct:((?i)[a-z0-9_]+([a-z0-9_\\.-]+[a-z0-9_]+)?)@{}$",
|
||||||
|
data.domain()
|
||||||
|
))
|
||||||
.map_err(Error::other)?;
|
.map_err(Error::other)?;
|
||||||
Ok(regex
|
Ok(regex
|
||||||
.captures(query)
|
.captures(query)
|
||||||
|
|
Loading…
Reference in a new issue