diff options
author | fox <[email protected]> | 2020-12-16 11:06:48 +0000 |
---|---|---|
committer | Gogs <[email protected]> | 2020-12-16 11:06:48 +0000 |
commit | ef7e67936350fce7b29499d6917d2a577105c779 (patch) | |
tree | 2f0ea59f0fc41d2ffed49c78214de69ae6b54d76 /classes/urlhelper.php | |
parent | b4b2ba99effc4c6f8465e907bf95b6c2f6452fdb (diff) | |
parent | 62da307ef147b32eb214edecf1541f8ce896a700 (diff) |
Merge branch 'feature/php8' of wn/tt-rss into master
Diffstat (limited to 'classes/urlhelper.php')
-rw-r--r-- | classes/urlhelper.php | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/classes/urlhelper.php b/classes/urlhelper.php index cc1074c55..fec36de51 100644 --- a/classes/urlhelper.php +++ b/classes/urlhelper.php @@ -1,8 +1,9 @@ <?php class UrlHelper { static function build_url($parts) { - $tmp = $parts['scheme'] . "://" . $parts['host'] . $parts['path']; + $tmp = $parts['scheme'] . "://" . $parts['host']; + if (isset($parts['path'])) $tmp .= $parts['path']; if (isset($parts['query'])) $tmp .= '?' . $parts['query']; if (isset($parts['fragment'])) $tmp .= '#' . $parts['fragment']; @@ -35,11 +36,13 @@ class UrlHelper { $rel_parts['host'] = $parts['host']; $rel_parts['scheme'] = $parts['scheme']; - if (strpos($rel_parts['path'], '/') !== 0) - $rel_parts['path'] = '/' . $rel_parts['path']; + if (isset($rel_parts['path'])) { + if (strpos($rel_parts['path'], '/') !== 0) + $rel_parts['path'] = '/' . $rel_parts['path']; - $rel_parts['path'] = str_replace("/./", "/", $rel_parts['path']); - $rel_parts['path'] = str_replace("//", "/", $rel_parts['path']); + $rel_parts['path'] = str_replace("/./", "/", $rel_parts['path']); + $rel_parts['path'] = str_replace("//", "/", $rel_parts['path']); + } return self::validate(self::build_url($rel_parts)); } |