rewrite_relative_url: only skip urls like magnet: instead of everything with :

This commit is contained in:
Andrew Dolgov 2016-02-20 12:06:47 +03:00
parent 7bbe94bc93
commit 94d425fe4a
1 changed files with 5 additions and 5 deletions

View File

@ -2048,15 +2048,15 @@
* @return string Absolute URL * @return string Absolute URL
*/ */
function rewrite_relative_url($url, $rel_url) { function rewrite_relative_url($url, $rel_url) {
if (strpos($rel_url, ":") !== false) { if (strpos($rel_url, "://") !== false) {
return $rel_url;
} else if (strpos($rel_url, "://") !== false) {
return $rel_url; return $rel_url;
} else if (strpos($rel_url, "//") === 0) { } else if (strpos($rel_url, "//") === 0) {
# protocol-relative URL (rare but they exist) # protocol-relative URL (rare but they exist)
return $rel_url; return $rel_url;
} else if (strpos($rel_url, "/") === 0) } else if (preg_match("/^[a-z]+:/i", $rel_url)) {
{ # magnet:, feed:, etc
return $rel_url;
} else if (strpos($rel_url, "/") === 0) {
$parts = parse_url($url); $parts = parse_url($url);
$parts['path'] = $rel_url; $parts['path'] = $rel_url;