aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorhopleus <124590925+hopleus@users.noreply.github.com>2024-02-29 16:16:57 +0300
committerGitHub <noreply@github.com>2024-02-29 16:16:57 +0300
commitfefa3382e72fa6d49c2f36d890731d272be0d893 (patch)
treefea22374675b7d76151f34ad4b27344239f55f54 /lib/private/Files
parent2c79492f68421d87e455b6b10863eac40198cc17 (diff)
parentfa0e3d66ba2af3b51121fe19f5afd50309a36475 (diff)
downloadnextcloud-server-fefa3382e72fa6d49c2f36d890731d272be0d893.tar.gz
nextcloud-server-fefa3382e72fa6d49c2f36d890731d272be0d893.zip
Merge branch 'master' into bugfix/fixed-get-filename-in-fileinfo
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Storage/Common.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index 830f0aaded7..0d4e8d29295 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -567,7 +567,9 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
* @throws InvalidPathException
*/
protected function verifyPosixPath($fileName) {
- $this->scanForInvalidCharacters($fileName, "\\/");
+ $invalidChars = \OCP\Util::getForbiddenFileNameChars();
+ $this->scanForInvalidCharacters($fileName, $invalidChars);
+
$fileName = trim($fileName);
$reservedNames = ['*'];
if (in_array($fileName, $reservedNames)) {
@@ -577,11 +579,11 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
/**
* @param string $fileName
- * @param string $invalidChars
+ * @param string[] $invalidChars
* @throws InvalidPathException
*/
- private function scanForInvalidCharacters($fileName, $invalidChars) {
- foreach (str_split($invalidChars) as $char) {
+ private function scanForInvalidCharacters(string $fileName, array $invalidChars) {
+ foreach ($invalidChars as $char) {
if (str_contains($fileName, $char)) {
throw new InvalidCharacterInPathException();
}
@@ -668,7 +670,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
private function isSameStorage(IStorage $storage): bool {
while ($storage->instanceOfStorage(Wrapper::class)) {
/**
- * @var Wrapper $sourceStorage
+ * @var Wrapper $storage
*/
$storage = $storage->getWrapperStorage();
}