Skip to content

Commit 37521ba

Browse files
committed
More code cleanup
Signed-off-by: Matt Friedman <maf675@gmail.com>
1 parent 114222e commit 37521ba

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

notification/method/webpush.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,12 +451,11 @@ protected function prepare_avatar($avatar)
451451
{
452452
$pattern = '/src=["\']?([^"\'>]+)["\']?/';
453453

454-
if (preg_match_all($pattern, $avatar, $matches, PREG_SET_ORDER))
455-
{
456-
$avatar = $matches[1][1] ?? $matches[0][1];
457-
}
454+
preg_match_all($pattern, $avatar, $matches);
455+
456+
$path = !empty($matches[1]) ? end($matches[1]) : $avatar;
458457

459-
return preg_replace('#^' . preg_quote($this->path_helper->get_web_root_path(), '#') . '#', $this->get_board_url(), $avatar, 1);
458+
return preg_replace('#^' . preg_quote($this->path_helper->get_web_root_path(), '#') . '#', $this->get_board_url(), $path, 1);
460459
}
461460

462461
/**

0 commit comments

Comments
 (0)