Add an exception to method 'whitelist_protocols' for url which started with '#'

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
This commit is contained in:
aguy 2020-02-28 15:14:22 +00:00 committed by GitHub
parent 810f0f6c96
commit 424530d9af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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