Skip to content

Commit a8ab67f

Browse files
authored
Merge pull request #7676 from nextcloud/fix-slash-in-filename
Show warning if slash is entered as filename
2 parents 02b092f + 0b4d186 commit a8ab67f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden;
3030
use OCP\Files\StorageNotAvailableException;
3131
use OCP\ILogger;
32+
use Sabre\DAV\Exception\Conflict;
3233
use Sabre\DAV\Exception\Forbidden;
3334
use Sabre\DAV\Exception\InvalidSyncToken;
3435
use Sabre\DAV\Exception\NotAuthenticated;
@@ -61,6 +62,9 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
6162
// happens if some a client uses the wrong method for a given URL
6263
// the error message itself is visible on the client side anyways
6364
NotImplemented::class => true,
65+
// happens when the parent directory is not present (for example when a
66+
// move is done to a non-existent directory)
67+
Conflict::class => true,
6468
];
6569

6670
/** @var string */

apps/files/js/files.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@
128128
throw t('files', '"{name}" is an invalid file name.', {name: name});
129129
} else if (trimmedName.length === 0) {
130130
throw t('files', 'File name cannot be empty.');
131+
} else if (trimmedName.indexOf('/') !== -1) {
132+
throw t('files', '"/" is not allowed inside a file name.');
131133
} else if (OC.fileIsBlacklisted(trimmedName)) {
132134
throw t('files', '"{name}" is not an allowed filetype', {name: name});
133135
}

0 commit comments

Comments
 (0)