From 6a813aa63ebfe5b12fb2530e0233fb8d747eafc8 Mon Sep 17 00:00:00 2001 From: Shane Cooke Date: Mon, 19 Aug 2024 15:31:52 +0200 Subject: [PATCH] Update extensions.php Updated the regex pattern to allow any Unicode character in the filename. --- helpers/extensions.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/helpers/extensions.php b/helpers/extensions.php index c83f4e4c..d355b755 100644 --- a/helpers/extensions.php +++ b/helpers/extensions.php @@ -223,12 +223,14 @@ function GetUserDisplayName($user) function IsValidFileName($fileName) { - if (preg_match('=^[^/?*;:{}\\\\]+\.[^/?*;:{}\\\\]+$=', $fileName)) - { - return true; - } + // Pattern allows any Unicode character except '/', '?', '*', ':', ';', '{', '}', '\' + $pattern = '/^[^\x00-\x1F\/?:*;"{}\\\]+(\.[^\x00-\x1F\/?:*;"{}\\\]+)?$/u'; + + if (preg_match($pattern, $fileName)) { + return true; + } - return false; + return false; } function IsJsonString($text)