-
-
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
[stable10] Make sure we don't scan files that can not be accessed #2465
[stable10] Make sure we don't scan files that can not be accessed #2465
Conversation
@nickvergessen, thanks for your PR! By analyzing the history of the files in this pull request, we identified @icewind1991, @butonic and @schiessle to be potential reviewers. |
fc7c611
to
454cd37
Compare
Signed-off-by: Joas Schilling <coding@schilljs.com>
454cd37
to
eefd458
Compare
@@ -132,6 +132,24 @@ protected function getData($path) { | |||
*/ | |||
public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true) { | |||
|
|||
if (!\OC::$server->getDatabaseConnection()->supports4ByteText()) { |
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.
Error: Call to undefined method OC\DB\Connection::supports4ByteText() in
🙈
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 | ||
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 | ||
)%xs', $file)) { | ||
// 4-byte characters are not supported in file names |
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.
But this is only the case for mysql, right?
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.
Not really, because this is also what the view checks:
server/lib/private/Files/View.php
Lines 1809 to 1816 in 072794d
// verify database - e.g. mysql only 3-byte chars | |
if (preg_match('%(?: | |
\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 | |
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 | |
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 | |
)%xs', $fileName)) { | |
throw new InvalidPathException($l10n->t('4-byte characters are not supported in file names')); | |
} |
Tested and works 👍 |
LGTM |
Backport of #1972
Let's only backport the first simple commit, without the new classes etc.
@icewind1991 @MorrisJobke