aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoraguy tech <aguytech@free.fr>2020-03-01 12:45:27 +0100
committeraguy tech <aguytech@free.fr>2020-03-01 12:45:27 +0100
commitdaba3f287190ab58bde1db5eaaa09da42c8d5c57 (patch)
tree6a01e09e0731bd02a44f65b6421f26327ddf2e08
parentd63ff87a009313141ae684ec447b902562ff6ee7 (diff)
downloadShaarli-daba3f287190ab58bde1db5eaaa09da42c8d5c57.tar.gz
Shaarli-daba3f287190ab58bde1db5eaaa09da42c8d5c57.tar.zst
Shaarli-daba3f287190ab58bde1db5eaaa09da42c8d5c57.zip
Add an exception to method 'whitelist_protocols' for url started with '#'
Allows local link for markdown. Actually a local link write with '[text](#local_link)' in MD syntax produce 'http://#local_link' in place of '#local_link'
-rw-r--r--application/http/UrlUtils.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/application/http/UrlUtils.php b/application/http/UrlUtils.php
index 4bc84b82..e8d1a283 100644
--- a/application/http/UrlUtils.php
+++ b/application/http/UrlUtils.php
@@ -73,7 +73,7 @@ function add_trailing_slash($url)
73 */ 73 */
74function whitelist_protocols($url, $protocols) 74function whitelist_protocols($url, $protocols)
75{ 75{
76 if (startsWith($url, '?') || startsWith($url, '/')) { 76 if (startsWith($url, '?') || startsWith($url, '/') || startsWith($url, '#')) {
77 return $url; 77 return $url;
78 } 78 }
79 $protocols = array_merge(['http', 'https'], $protocols); 79 $protocols = array_merge(['http', 'https'], $protocols);