From 19d5987c9d5f4b49f1b7944803ea8b46d3f9aef7 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 1 Oct 2021 13:25:00 +0000 Subject: [PATCH] Sanitize the addon author if it is not a valid URL but a handle --- src/Core/Addon.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Core/Addon.php b/src/Core/Addon.php index db358db45..a1b35471f 100644 --- a/src/Core/Addon.php +++ b/src/Core/Addon.php @@ -23,6 +23,7 @@ namespace Friendica\Core; use Friendica\Database\DBA; use Friendica\DI; +use Friendica\Model\Contact; use Friendica\Util\Strings; /** @@ -257,6 +258,12 @@ class Addon if ($type == "author" || $type == "maintainer") { $r = preg_match("|([^<]+)<([^>]+)>|", $v, $m); if ($r) { + if (!empty($m[2]) && empty(parse_url($m[2], PHP_URL_SCHEME))) { + $contact = Contact::getByURL($m[2], false); + if (!empty($contact['url'])) { + $m[2] = $contact['url']; + } + } $info[$type][] = ['name' => $m[1], 'link' => $m[2]]; } else { $info[$type][] = ['name' => $v];