Merge pull request #3545 from nextcloud/enh/noid/fix-regex

This commit is contained in:
Simon L 2023-10-17 12:40:58 +02:00 committed by GitHub
commit 28b8be112f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -729,7 +729,7 @@ class ConfigurationManager
// Trim all unwanted chars on both sites // Trim all unwanted chars on both sites
$entry = trim($entry); $entry = trim($entry);
if ($entry !== "") { if ($entry !== "") {
if (!preg_match("#^/[.0-1a-zA-Z/-_]+$#", $entry) && !preg_match("#^[.0-1a-zA-Z_-]+$#", $entry)) { if (!preg_match("#^/[.0-1a-zA-Z/_-]+$#", $entry) && !preg_match("#^[.0-1a-zA-Z_-]+$#", $entry)) {
throw new InvalidSettingConfigurationException("You entered unallowed characters! Problematic is " . $entry); throw new InvalidSettingConfigurationException("You entered unallowed characters! Problematic is " . $entry);
} }
$validDirectories .= rtrim($entry, '/') . PHP_EOL; $validDirectories .= rtrim($entry, '/') . PHP_EOL;