diff options
author | aguy tech <aguytech@free.fr> | 2020-03-01 12:45:27 +0100 |
---|---|---|
committer | aguy tech <aguytech@free.fr> | 2020-03-01 12:45:27 +0100 |
commit | daba3f287190ab58bde1db5eaaa09da42c8d5c57 (patch) | |
tree | 6a01e09e0731bd02a44f65b6421f26327ddf2e08 | |
parent | d63ff87a009313141ae684ec447b902562ff6ee7 (diff) | |
download | Shaarli-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.php | 2 |
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 | */ |
74 | function whitelist_protocols($url, $protocols) | 74 | function 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); |