Skip to content
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

Merged
merged 1 commit into from
Dec 5, 2016

Conversation

nickvergessen
Copy link
Member

Backport of #1972

Let's only backport the first simple commit, without the new classes etc.

@icewind1991 @MorrisJobke

@nickvergessen nickvergessen added 3. to review Waiting for reviews bug labels Dec 2, 2016
@nickvergessen nickvergessen added this to the Nextcloud 10.0.2 milestone Dec 2, 2016
@mention-bot
Copy link

@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.

@nickvergessen nickvergessen force-pushed the backport-1972-invalid-files-from-scanner branch from fc7c611 to 454cd37 Compare December 2, 2016 10:12
Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen nickvergessen force-pushed the backport-1972-invalid-files-from-scanner branch from 454cd37 to eefd458 Compare December 2, 2016 10:14
@@ -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()) {
Copy link
Member

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
Copy link
Member

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?

Copy link
Member Author

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:

// 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'));
}

@MorrisJobke
Copy link
Member

Tested and works 👍

@LukasReschke
Copy link
Member

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants