-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not allow RTLO char in filenames #10030
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,6 +105,23 @@ public function providesAstralPlane() { | |
]; | ||
} | ||
|
||
|
||
/** | ||
* @dataProvider providesInvalidUnicode | ||
*/ | ||
public function testPathVerificationInvalidUnicode(string $fileName) { | ||
$this->expectException(InvalidPathException::class); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't you throwing an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that it's a specialization but I just wanted to bring it up in case this wasn't intentional 😉 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah we are. But it is internal mainly. The point here is that we get that the path is invalid :) |
||
$this->expectExceptionMessage('File name contains at least one invalid character'); | ||
|
||
$this->view->verifyPath('', $fileName); | ||
} | ||
|
||
public function providesInvalidUnicode() { | ||
return [ | ||
['foo' . mb_chr(8238, 'utf8') . 'txt.html'], //RTLO | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider providesInvalidCharsPosix | ||
* @expectedException \OCP\Files\InvalidCharacterInPathException | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mb_chr
is php 7.2+ so we can't use itThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/nextcloud/3rdparty/blob/master/symfony/polyfill-mbstring/bootstrap.php#L56