Merge pull request #47626 from nextcloud/backport/47546/stable30

pull/47641/head
John Molakvoæ 2024-08-30 15:56:47 +07:00 committed by GitHub
commit 791fc9d95a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

@ -1852,13 +1852,13 @@ class View {
$storage->verifyPath($internalPath, $fileName);
} catch (ReservedWordException $ex) {
$l = \OCP\Util::getL10N('lib');
throw new InvalidPathException($l->t('File name is a reserved word'));
throw new InvalidPathException($ex->getMessage() ?: $l->t('Filename is a reserved word'));
} catch (InvalidCharacterInPathException $ex) {
$l = \OCP\Util::getL10N('lib');
throw new InvalidPathException($l->t('File name contains at least one invalid character'));
throw new InvalidPathException($ex->getMessage() ?: $l->t('Filename contains at least one invalid character'));
} catch (FileNameTooLongException $ex) {
$l = \OCP\Util::getL10N('lib');
throw new InvalidPathException($l->t('File name is too long'));
throw new InvalidPathException($l->t('Filename is too long'));
} catch (InvalidDirectoryException $ex) {
$l = \OCP\Util::getL10N('lib');
throw new InvalidPathException($l->t('Dot files are not allowed'));

@ -32,7 +32,7 @@ class PathVerificationTest extends \Test\TestCase {
public function testPathVerificationFileNameTooLong() {
$this->expectException(\OCP\Files\InvalidPathException::class);
$this->expectExceptionMessage('File name is too long');
$this->expectExceptionMessage('Filename is too long');
$fileName = str_repeat('a', 500);
$this->view->verifyPath('', $fileName);