Skip to content

Commit

Permalink
Fixed #3852
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Feb 19, 2019
1 parent f10459a commit 2423af3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
### Fixed
- Fixed a bug where Craft could auto-place the `{{ beginBody() }}` and `{{ endBody() }}` tags in the wrong places.
- Fixed a bug where Craft wasn’t storing custom volume sort orders. ([#3764](https://github.com/craftcms/cms/issues/3764))
- Fixed a SQL error that would occur when uploading a file with emojis in its name, if using MySQL. ([#3852](https://github.com/craftcms/cms/issues/3852))

## 3.1.12 - 2019-02-15

Expand Down
5 changes: 5 additions & 0 deletions src/helpers/FileHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ public static function sanitizeFilename(string $filename, array $options = []):
// Strip any characters not allowed.
$filename = str_replace($disallowedChars, '', strip_tags($filename));

if (Craft::$app->getDb()->getIsMysql()) {
// Strip emojis
$filename = StringHelper::replaceMb4($filename, '');
}

if ($separator !== null) {
$filename = preg_replace('/(\s|' . preg_quote($separator, '/') . ')+/u', $separator, $filename);
}
Expand Down

0 comments on commit 2423af3

Please sign in to comment.