summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-07-30 16:07:46 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-07-30 16:07:46 +0200
commit22fd04eb4117e80341becce13190d5a8fcea98ca (patch)
tree3b1d465b152a6885da7bc7458312cf3acc94543b
parent80810ae10fc7ea40a8ffe1c6f4672f5f2096f402 (diff)
parent52cd4efc8324559215cb14f3f7bbc61f55e4c1d2 (diff)
downloadnextcloud-server-22fd04eb4117e80341becce13190d5a8fcea98ca.tar.gz
nextcloud-server-22fd04eb4117e80341becce13190d5a8fcea98ca.zip
Merge pull request #17981 from owncloud/correct-regex
Correct regular expressions
-rw-r--r--lib/private/files/view.php4
-rw-r--r--tests/lib/files/pathverificationtest.php4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index cb3c05d2bca..1a6be73d5bb 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 b59aceba7b1..13fccd310f3 100644
--- a/tests/lib/files/pathverificationtest.php
+++ b/tests/lib/files/pathverificationtest.php
@@ -83,6 +83,10 @@ 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.💩'],
+ ['💩🐵.txt'],
+ ['💩🐵'],
];
}