X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2FProbe.php;h=6359d8607a4699ea1b50f0fdf52d9c12150f8b55;hb=befc2af5043a3afde251721c0d27df695db1bb7e;hp=67db29a4f3536fe9b0e98332de9578ac55db8b8a;hpb=5232a8583f8d0ca5e6339e067814ff6f32dcf3fe;p=friendica.git diff --git a/src/Network/Probe.php b/src/Network/Probe.php index 67db29a4f3..6359d8607a 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -1,6 +1,6 @@ loadHTML($body)) { return false; @@ -1801,26 +1805,28 @@ class Probe $hrefParts = parse_url($href); - // Root path case (/path) including relative scheme case (//host/path) - if ($hrefParts['path'] && $hrefParts['path'][0] == '/') { - $path = $hrefParts['path']; - } else { - $path = $path . '/' . $hrefParts['path']; - - // Resolve arbitrary relative path - // Lifted from https://www.php.net/manual/en/function.realpath.php#84012 - $parts = array_filter(explode('/', $path), 'strlen'); - $absolutes = array(); - foreach ($parts as $part) { - if ('.' == $part) continue; - if ('..' == $part) { - array_pop($absolutes); - } else { - $absolutes[] = $part; + if (!empty($hrefParts['path'])) { + // Root path case (/path) including relative scheme case (//host/path) + if ($hrefParts['path'] && $hrefParts['path'][0] == '/') { + $path = $hrefParts['path']; + } else { + $path = $path . '/' . $hrefParts['path']; + + // Resolve arbitrary relative path + // Lifted from https://www.php.net/manual/en/function.realpath.php#84012 + $parts = array_filter(explode('/', $path), 'strlen'); + $absolutes = array(); + foreach ($parts as $part) { + if ('.' == $part) continue; + if ('..' == $part) { + array_pop($absolutes); + } else { + $absolutes[] = $part; + } } - } - $path = '/' . implode('/', $absolutes); + $path = '/' . implode('/', $absolutes); + } } // Relative scheme case (//host/path)