aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Files
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Files')
-rw-r--r--lib/public/Files/IFilenameValidator.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/public/Files/IFilenameValidator.php b/lib/public/Files/IFilenameValidator.php
index 2bd3bb945dc..d8bd06d179d 100644
--- a/lib/public/Files/IFilenameValidator.php
+++ b/lib/public/Files/IFilenameValidator.php
@@ -36,4 +36,17 @@ interface IFilenameValidator {
* @since 30.0.0
*/
public function validateFilename(string $filename): void;
+
+ /**
+ * Sanitize a give filename to comply with admin setup naming constrains.
+ *
+ * If no sanitizing is needed the same name is returned.
+ *
+ * @param string $name The filename to sanitize
+ * @param null|string $charReplacement Character to use for replacing forbidden ones - by default space, dash or underscore is used if allowed.
+ * @throws \InvalidArgumentException if no character replacement was given (and the default could not be applied) or the replacement is not valid.
+ * @since 32.0.0
+ */
+ public function sanitizeFilename(string $name, ?string $charReplacement = null): string;
+
}