summaryrefslogtreecommitdiff
path: root/classes/urlhelper.php
diff options
context:
space:
mode:
authorPhilip Klempin <[email protected]>2021-06-07 00:51:02 +0200
committerPhilip Klempin <[email protected]>2021-06-16 15:24:15 +0200
commitb3bedd0a94264fe1fcff1e2cf6ab255941632b07 (patch)
tree4163a8fab390a99ad4a529711a5d2c129d852aad /classes/urlhelper.php
parent92c78beb909d8955657564127c2e953ca25113e3 (diff)
Skip URI base on ALLOWED_RELATIVE_SCHEMES in rewrite_relative
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);