[Pkg-owncloud-commits] [owncloud] 07/79: Correct regular expressions
David Prévot
taffit at moszumanska.debian.org
Tue Sep 1 20:55:33 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit c61b23561b6da206a684d09f930332e4c88ec778
Author: Lukas Reschke <lukas at owncloud.com>
Date: Thu Jul 30 11:22:14 2015 +0200
Correct regular expressions
Previously the regex was only matching on single characters. Meaning that file names such as ":+1:.txt" where possible while ":+1:" alone never was. This check apparently never worked as expected.
---
lib/private/files/view.php | 4 ++--
tests/lib/files/pathverificationtest.php | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 1706818..fdc8b00 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -1656,11 +1656,11 @@ class View {
}
// verify database - e.g. mysql only 3-byte chars
- if (preg_match('%^(?:
+ 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)) {
+)%xs', $fileName)) {
throw new InvalidPathException($l10n->t('4-byte characters are not supported in file names'));
}
diff --git a/tests/lib/files/pathverificationtest.php b/tests/lib/files/pathverificationtest.php
index b59aceb..f7d5f05 100644
--- a/tests/lib/files/pathverificationtest.php
+++ b/tests/lib/files/pathverificationtest.php
@@ -83,6 +83,8 @@ class PathVerification extends \Test\TestCase {
return [
// this is the monkey emoji - http://en.wikipedia.org/w/index.php?title=%F0%9F%90%B5&redirect=no
['🐵'],
+ ['🐵.txt'],
+ ['txt.💩'],
];
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list