1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 16:24:29 +00:00

Update Nickname lexer

This commit is contained in:
Daniel Supernault 2018-04-29 10:26:58 -06:00
parent 0f6728bfe3
commit e96fa8ce72

View file

@ -6,6 +6,10 @@ class Nickname {
public static function normalizeProfileUrl($url) public static function normalizeProfileUrl($url)
{ {
if(starts_with($url, 'acct:')) {
$url = str_replace('acct:', '', $url);
}
if(!str_contains($url, '@') && filter_var($url, FILTER_VALIDATE_URL)) { if(!str_contains($url, '@') && filter_var($url, FILTER_VALIDATE_URL)) {
$parsed = parse_url($url); $parsed = parse_url($url);
$username = str_replace(['/','\\','@'], '', $parsed['path']); $username = str_replace(['/','\\','@'], '', $parsed['path']);