Correct regular expressions
Previously the regex was only matching on single characters. Meaning that file names such as "👍.txt" where possible while "👍" alone never was. This check apparently never worked as expected.
This commit is contained in:
parent
f1749ddb01
commit
ad4c731c4c
|
@ -1656,11 +1656,11 @@ class View {
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify database - e.g. mysql only 3-byte chars
|
// verify database - e.g. mysql only 3-byte chars
|
||||||
if (preg_match('%^(?:
|
if (preg_match('%(?:
|
||||||
\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
|
\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
|
||||||
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
|
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
|
||||||
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
|
| \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'));
|
throw new InvalidPathException($l10n->t('4-byte characters are not supported in file names'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,8 @@ class PathVerification extends \Test\TestCase {
|
||||||
return [
|
return [
|
||||||
// this is the monkey emoji - http://en.wikipedia.org/w/index.php?title=%F0%9F%90%B5&redirect=no
|
// this is the monkey emoji - http://en.wikipedia.org/w/index.php?title=%F0%9F%90%B5&redirect=no
|
||||||
['🐵'],
|
['🐵'],
|
||||||
|
['🐵.txt'],
|
||||||
|
['txt.💩'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue