mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Support additional file name and path characters in media manager (#4564)
* Support additional file name and path characters in media manager When working with abstract file names that may contain additional characters, such as quotes or ampersands, the media manager would throw an error. This PR adds two additional characters to the character whitelist. * Add unicode filename to tests
This commit is contained in:
parent
9dc54baddd
commit
2b05d01c6c
@ -486,6 +486,8 @@ class MediaLibrary
|
||||
preg_quote(']', '/'),
|
||||
preg_quote(',', '/'),
|
||||
preg_quote('=', '/'),
|
||||
preg_quote("'", '/'),
|
||||
preg_quote('&', '/'),
|
||||
];
|
||||
|
||||
if (!preg_match('/^[' . implode('', $regexWhitelist) . ']+$/iu', $path)) {
|
||||
|
@ -37,6 +37,11 @@ class MediaLibraryTest extends TestCase // @codingStandardsIgnoreLine
|
||||
['one(two)[].ext'],
|
||||
['one=(two)[].ext'],
|
||||
['one_(two)[].ext'],
|
||||
/*
|
||||
Example of a unicode-based filename with a single quote
|
||||
@see: https://github.com/octobercms/october/pull/4564
|
||||
*/
|
||||
['BG中国通讯期刊(Blend\'r)创刊号.pdf'],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user