diff --git a/lib/gallery.php b/lib/gallery.php index a79cde7b83..a478db25d5 100644 --- a/lib/gallery.php +++ b/lib/gallery.php @@ -31,17 +31,22 @@ class GalleryAction extends Action { function handle($args) { parent::handle($args); - $nickname = $this->arg('nickname'); - $profile = Profile::staticGet('nickname', $nickname); - if (!$profile) { - $this->no_such_user(); - return; - } - $user = User::staticGet($profile->id); + $nickname = common_canonical_nickname($this->arg('nickname')); + + $user = User::staticGet('nickname', $nickname); + if (!$user) { $this->no_such_user(); return; } + + $profile = $user->getProfile(); + + if (!$profile) { + $this->server_error(_('User without matching profile in system.')); + return; + } + $page = $this->arg('page'); if (!$page) { $page = 1; @@ -99,7 +104,7 @@ class GalleryAction extends Action { common_log(LOG_WARNING, 'No matching profile for ' . $other_id); continue; } - + common_element_start('li'); common_element_start('a', array('title' => ($other->fullname) ?