Skip to content

[stable10] Make sure we don't scan files that can not be accessed - #2465

Merged
LukasReschke merged 1 commit into
stable10from
backport-1972-invalid-files-from-scanner
Dec 5, 2016
Merged

[stable10] Make sure we don't scan files that can not be accessed#2465
LukasReschke merged 1 commit into
stable10from
backport-1972-invalid-files-from-scanner

Conversation

@nickvergessen

Copy link
Copy Markdown
Member

Backport of #1972

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

@icewind1991@MorrisJobke

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

Copy link
Copy Markdown

@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
nickvergessenforce-pushed the backport-1972-invalid-files-from-scanner branch from fc7c611 to 454cd37CompareDecember 2, 2016 10:12
Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen
nickvergessenforce-pushed the backport-1972-invalid-files-from-scanner branch from 454cd37 to eefd458CompareDecember 2, 2016 10:14
Comment threadlib/private/Files/Cache/Scanner.php Outdated
*/
public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true) {

if (!\OC::$server->getDatabaseConnection()->supports4ByteText()) {

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
MemberAuthor

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)) {
thrownewInvalidPathException($l10n->t('4-byte characters are not supported in file names'));
}

@MorrisJobke

Copy link
Copy Markdown
Member

Tested and works 👍

@LukasReschke

Copy link
Copy Markdown
Member

LGTM

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsbug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@nickvergessen@mention-bot@MorrisJobke@LukasReschke