Skip to content

Commit 791fc9d

Browse files
authored
Merge pull request #47626 from nextcloud/backport/47546/stable30
2 parents 9e0ddb6 + 6ea52ed commit 791fc9d

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/private/Files/View.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,13 +1852,13 @@ public function verifyPath($path, $fileName, $readonly = false): void {
18521852
$storage->verifyPath($internalPath, $fileName);
18531853
} catch (ReservedWordException $ex) {
18541854
$l = \OCP\Util::getL10N('lib');
1855-
throw new InvalidPathException($l->t('File name is a reserved word'));
1855+
throw new InvalidPathException($ex->getMessage() ?: $l->t('Filename is a reserved word'));
18561856
} catch (InvalidCharacterInPathException $ex) {
18571857
$l = \OCP\Util::getL10N('lib');
1858-
throw new InvalidPathException($l->t('File name contains at least one invalid character'));
1858+
throw new InvalidPathException($ex->getMessage() ?: $l->t('Filename contains at least one invalid character'));
18591859
} catch (FileNameTooLongException $ex) {
18601860
$l = \OCP\Util::getL10N('lib');
1861-
throw new InvalidPathException($l->t('File name is too long'));
1861+
throw new InvalidPathException($l->t('Filename is too long'));
18621862
} catch (InvalidDirectoryException $ex) {
18631863
$l = \OCP\Util::getL10N('lib');
18641864
throw new InvalidPathException($l->t('Dot files are not allowed'));

tests/lib/Files/PathVerificationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function setUp(): void {
3232

3333
public function testPathVerificationFileNameTooLong() {
3434
$this->expectException(\OCP\Files\InvalidPathException::class);
35-
$this->expectExceptionMessage('File name is too long');
35+
$this->expectExceptionMessage('Filename is too long');
3636

3737
$fileName = str_repeat('a', 500);
3838
$this->view->verifyPath('', $fileName);

0 commit comments

Comments
 (0)