Add error handling in Module\Xrd

- Address part of https://github.com/friendica/friendica/issues/8475#issuecomment-653912096
This commit is contained in:
Hypolite Petovan 2020-07-08 09:14:34 -04:00
parent 5c0e079ca6
commit f2adec6a7f

View file

@ -85,6 +85,11 @@ class Xrd extends BaseModule
$owner = User::getOwnerDataById($user['uid']); $owner = User::getOwnerDataById($user['uid']);
if (empty($owner)) {
DI::logger()->warning('No owner data for user id', ['uri' => $uri, 'name' => $name, 'user' => $user]);
throw new \Friendica\Network\HTTPException\NotFoundException();
}
$alias = str_replace('/profile/', '/~', $owner['url']); $alias = str_replace('/profile/', '/~', $owner['url']);
$avatar = Photo::selectFirst(['type'], ['uid' => $owner['uid'], 'profile' => true]); $avatar = Photo::selectFirst(['type'], ['uid' => $owner['uid'], 'profile' => true]);