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
-rw-r--r--lib/public/Files/SimpleFS/ISimpleFile.php10
2 files changed, 21 insertions, 2 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;
+
}
diff --git a/lib/public/Files/SimpleFS/ISimpleFile.php b/lib/public/Files/SimpleFS/ISimpleFile.php
index 2682c22580d..10cdc0a919d 100644
--- a/lib/public/Files/SimpleFS/ISimpleFile.php
+++ b/lib/public/Files/SimpleFS/ISimpleFile.php
@@ -5,8 +5,10 @@
*/
namespace OCP\Files\SimpleFS;
+use OCP\Files\GenericFileException;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
+use OCP\Lock\LockedException;
/**
* This interface allows to manage simple files.
@@ -49,8 +51,10 @@ interface ISimpleFile {
/**
* Get the content
*
- * @throws NotPermittedException
+ * @throws GenericFileException
+ * @throws LockedException
* @throws NotFoundException
+ * @throws NotPermittedException
* @since 11.0.0
*/
public function getContent(): string;
@@ -59,8 +63,10 @@ interface ISimpleFile {
* Overwrite the file
*
* @param string|resource $data
- * @throws NotPermittedException
+ * @throws GenericFileException
+ * @throws LockedException
* @throws NotFoundException
+ * @throws NotPermittedException
* @since 11.0.0
*/
public function putContent($data): void;