[ENTITY][LocalUser][CACHE] Remove bad keys from getByNickname cache key

This commit is contained in:
Hugo Sales 2021-11-16 13:14:21 +00:00
parent 0e104a9701
commit 7e4a971fac
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -354,7 +354,8 @@ class LocalUser extends Entity implements UserInterface
public static function getByNickname(string $nickname): ?self public static function getByNickname(string $nickname): ?self
{ {
return Cache::get("user-nickname-{$nickname}", fn () => DB::findOneBy('local_user', ['nickname' => $nickname])); $key = str_replace('_', '-', $nickname);
return Cache::get("user-nickname-{$key}", fn () => DB::findOneBy('local_user', ['nickname' => $nickname]));
} }
/** /**