From 1b9b9de58faa3ff350973c895c8ee97628b7b01f Mon Sep 17 00:00:00 2001 From: ozh Date: Wed, 29 Apr 2015 16:51:35 +0200 Subject: [PATCH] Allow brackets in URLs. Fixes #1814 I can't think of a good reason not to. --- includes/functions-formatting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/functions-formatting.php b/includes/functions-formatting.php index 774eeb7..066f705 100644 --- a/includes/functions-formatting.php +++ b/includes/functions-formatting.php @@ -494,7 +494,7 @@ function yourls_esc_url( $url, $context = 'display', $protocols = array() ) { // force scheme and domain to lowercase - see issues 591 and 1630 $url = yourls_lowercase_scheme_domain( $url ); - $url = preg_replace( '|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url ); + $url = preg_replace( '|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url ); // Previous regexp in YOURLS was '|[^a-z0-9-~+_.?\[\]\^#=!&;,/:%@$\|*`\'<>"()\\x80-\\xff\{\}]|i' // TODO: check if that was it too destructive $strip = array( '%0d', '%0a', '%0D', '%0A' ); -- 2.45.0