]> git.wh0rd.org Git - tt-rss.git/commitdiff
rewrite_relative_url: only skip urls like magnet: instead of everything with :
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Sat, 20 Feb 2016 09:06:47 +0000 (12:06 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Sat, 20 Feb 2016 09:06:47 +0000 (12:06 +0300)
include/functions2.php

index ed22a0623b9564401ee54294f9eb8ecd043b370c..811c72ee3d5eadc3fc578550d6b8158a882a6a64 100644 (file)
         * @return string Absolute URL
         */
        function rewrite_relative_url($url, $rel_url) {
-               if (strpos($rel_url, ":") !== false) {
-                       return $rel_url;
-               } else if (strpos($rel_url, "://") !== false) {
+               if (strpos($rel_url, "://") !== false) {
                        return $rel_url;
                } else if (strpos($rel_url, "//") === 0) {
                        # protocol-relative URL (rare but they exist)
                        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['path'] = $rel_url;