From 0a30b856ce37f22c3bfd2fdbf97c2c2c241ee413 Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Thu, 11 Jan 2024 12:52:18 -0500 Subject: [PATCH] Relax url shortener regex (http(s):// part is optional) --- inc/instance-config.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/inc/instance-config.php b/inc/instance-config.php index 9f260313..cba250c2 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -560,7 +560,17 @@ $config['filters'][] = array( $config['filters'][] = array( 'condition' => array( - 'body' => '/https?:\/\/\w{2,6}\.[a-z]{2,3}\/\w{2,8}(\s|$)/i', // url shorteners are not allowed + /* + * Old version: + * + * 'body' => '/https?:\/\/\w{2,6}\.[a-z]{2,3}\/\w{2,8}(\s|$)/i', // url shorteners are not allowed + * - has to have http(s):// + * + * + * New version: + * - optional http(s):// domain name (without tld) might have a dash - in it. + */ + 'body' => '/((https)?:\/\/)?[\w-]{2,6}\.[a-z]{2,3}\/\w{2,8}(\s|$)/i', // url shorteners are not allowed ), 'action' => 'reject', 'message' => 'Url shorteners are not allowed'