summaryrefslogtreecommitdiff
path: root/classes/urlhelper.php
diff options
context:
space:
mode:
authorfox <[email protected]>2021-06-17 18:51:35 +0300
committerfox <[email protected]>2021-06-17 18:51:35 +0300
commit34807bacd4b2d31b6268d839ccd5281db4ee4da2 (patch)
tree174f0a457c1ce05f476f5feea48afedf15bf212d /classes/urlhelper.php
parent4e9c3500fb3390d7eea7d07f22729a259997d521 (diff)
parentb3bedd0a94264fe1fcff1e2cf6ab255941632b07 (diff)
Merge pull request 'Skip all urls with schemes different from base_url in rewrite_relative' (#38) from klempin/tt-rss:fix/mailto into master
Reviewed-on: https://git.tt-rss.org/fox/tt-rss/pulls/38
Diffstat (limited to 'classes/urlhelper.php')
-rw-r--r--classes/urlhelper.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/classes/urlhelper.php b/classes/urlhelper.php
index 03f0c474d..648d609a4 100644
--- a/classes/urlhelper.php
+++ b/classes/urlhelper.php
@@ -1,5 +1,11 @@
<?php
class UrlHelper {
+ const ALLOWED_RELATIVE_SCHEMES = [
+ "magnet",
+ "mailto",
+ "tel"
+ ];
+
static $fetch_last_error;
static $fetch_last_error_code;
static $fetch_last_error_content;
@@ -36,8 +42,7 @@ class UrlHelper {
} else if (strpos($rel_url, "//") === 0) {
# protocol-relative URL (rare but they exist)
return self::validate("https:" . $rel_url);
- } else if (strpos($rel_url, "magnet:") === 0) {
- # allow magnet links
+ } else if (array_search($rel_parts["scheme"] ?? "", self::ALLOWED_RELATIVE_SCHEMES, true) !== false) {
return $rel_url;
} else {
$base_parts = parse_url($base_url);