]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Add an exception to method 'whitelist_protocols' for url which started with '#' 1424/head
authoraguy <aguytech@users.noreply.github.com>
Fri, 28 Feb 2020 15:14:22 +0000 (15:14 +0000)
committerGitHub <noreply@github.com>
Fri, 28 Feb 2020 15:14:22 +0000 (15:14 +0000)
This is to allow local link for markdown, actually a local link write with this syntax : '[anchor](#local_link)' produce this html code: http://#local_link

application/http/UrlUtils.php

index 4bc84b823d7ce8d3d44dec028facb6ab28610aed..e8d1a283fca632ecce9af242f8676c7f824015a4 100644 (file)
@@ -73,7 +73,7 @@ function add_trailing_slash($url)
  */
 function whitelist_protocols($url, $protocols)
 {
-    if (startsWith($url, '?') || startsWith($url, '/')) {
+    if (startsWith($url, '?') || startsWith($url, '/') || startsWith($url, '#')) {
         return $url;
     }
     $protocols = array_merge(['http', 'https'], $protocols);