]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Add an exception to method 'whitelist_protocols' for url started with '#'
authoraguy tech <aguytech@free.fr>
Sun, 1 Mar 2020 11:45:27 +0000 (12:45 +0100)
committeraguy tech <aguytech@free.fr>
Sun, 1 Mar 2020 11:45:27 +0000 (12:45 +0100)
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'

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);