aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Util.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Util.php')
-rw-r--r--lib/public/Util.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/public/Util.php b/lib/public/Util.php
index 6e172e68d71..bdd2dd25f01 100644
--- a/lib/public/Util.php
+++ b/lib/public/Util.php
@@ -540,6 +540,20 @@ class Util {
\OCP\Server::get(LoggerInterface::class)->error('Invalid system config value for "blacklisted_files" is ignored.');
$invalidFilenames = ['.htaccess'];
}
+
+ if ($config->getSystemValueBool('enforce_windows_compatibility', false)) {
+ $invalidFilenames = array_merge(
+ $invalidFilenames,
+ [
+ "CON", "PRN", "AUX", "NUL", "COM0",
+ "COM1", "COM2", "COM3", "COM4", "COM5",
+ "COM6", "COM7", "COM8", "COM9", "COM¹",
+ "COM²", "COM³", "LPT0", "LPT1", "LPT2",
+ "LPT3", "LPT4", "LPT5", "LPT6", "LPT7",
+ "LPT8", "LPT9", "LPT¹", "LPT²", "LPT³",
+ ],
+ );
+ }
self::$invalidFilenames = array_map('mb_strtolower', $invalidFilenames);
}
return self::$invalidFilenames;
@@ -564,6 +578,17 @@ class Util {
$invalidChars = [];
}
+ // If windows compatibility is enabled we also forbidd reserved win32 API characters
+ if ($config->getSystemValueBool('enforce_windows_compatibility', false)) {
+ $invalidChars = array_merge(
+ $invalidChars,
+ // reserved characters of the win32 API
+ ['<', '>', ':', '"', '|', '?', '*'],
+ // character 0-31 are also forbiden on windows but already filtered
+ // see IStorage::verifyPath
+ );
+ }
+
// Get admin defined invalid characters
$additionalChars = $config->getSystemValue('forbidden_chars', []);
if (!is_array($additionalChars)) {