diff --git a/src/Model/Item.php b/src/Model/Item.php index 859deacc3..13da8ec75 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -2889,6 +2889,20 @@ class Item DI::profiler()->saveTimestamp($stamp1, 'rendering'); if (isset($data['url']) && !in_array($data['url'], $ignore_links)) { + $parts = parse_url($data['url']); + if (!empty($parts['scheme']) && !empty($parts['host'])) { + if (empty($data['provider_name'])) { + $data['provider_name'] = $parts['host']; + } + if (empty($data['provider_url']) || empty(parse_url($data['provider_url'], PHP_URL_SCHEME))) { + $data['provider_url'] = $parts['scheme'] . '://' . $parts['host']; + + if (!empty($parts['port'])) { + $data['provider_url'] .= ':' . $parts['port']; + } + } + } + // @todo Use a template $rendered = BBCode::convertAttachment('', BBCode::INTERNAL, false, $data); if ($shared) {