From d0b3f0b4e2cc1eac74f6dd3235fbf4804f65e254 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Mon, 18 Dec 2023 08:49:28 +0000
Subject: [PATCH] fixes #3571

Closes #3571

Merge request studip/studip!2462
---
 app/controllers/blubber.php      | 2 +-
 lib/classes/StudipCoreFormat.php | 3 ++-
 lib/visual.inc.php               | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/app/controllers/blubber.php b/app/controllers/blubber.php
index bd86050a1e4..c0490f03d37 100644
--- a/app/controllers/blubber.php
+++ b/app/controllers/blubber.php
@@ -351,7 +351,7 @@ class BlubberController extends AuthenticatedController
                     if (mb_strpos($file['type'], 'video') !== false) {
                         $type = 'video';
                     }
-                    if (mb_strpos($file['type'], 'audio') !== false || mb_strpos($file_ref['name'], '.ogg') !== false) {
+                    if (mb_strpos($file['type'], 'audio') !== false || mb_strpos($file['name'], '.ogg') !== false) {
                         $type = 'audio';
                     }
                     if ($type) {
diff --git a/lib/classes/StudipCoreFormat.php b/lib/classes/StudipCoreFormat.php
index b6562527df5..ee401c19489 100644
--- a/lib/classes/StudipCoreFormat.php
+++ b/lib/classes/StudipCoreFormat.php
@@ -568,7 +568,8 @@ class StudipCoreFormat extends TextFormat
         if (
             in_array($pu['scheme'], ['http', 'https'])
             && (
-                $pu['host'] === $_SERVER['HTTP_HOST']
+                !isset($pu['host'])
+                || $pu['host'] === $_SERVER['HTTP_HOST']
                 || (isset($pu['port']) && $pu['host'] . ':' . $pu['port'] === $_SERVER['HTTP_HOST'])
             )
             && mb_strpos($pu['path'], $GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP']) === 0
diff --git a/lib/visual.inc.php b/lib/visual.inc.php
index 80133fd7a8f..98d2b21eef2 100644
--- a/lib/visual.inc.php
+++ b/lib/visual.inc.php
@@ -330,7 +330,7 @@ function idna_link($link, $mail = false) {
         return $link;
     }
     $pu = @parse_url($link);
-    if (preg_match('/&\w+;/i', $pu['host'])) { //umlaute?  (html-coded)
+    if (isset($pu['host']) && preg_match('/&\w+;/i', $pu['host'])) { //umlaute?  (html-coded)
         $IDN = new Algo26\IdnaConvert\ToIdn();
         $out = false;
         if ($mail){
-- 
GitLab