Tidy up from #1377

This commit is contained in:
Samuel Georges 2015-08-22 08:47:35 +10:00
parent 14f8abac4d
commit 742ae07391
1 changed files with 6 additions and 4 deletions

View File

@ -963,13 +963,15 @@ class MediaManager extends WidgetBase
$fileName = $uploadedFile->getClientOriginalName();
// If name of our uploadfile not latin
/*
* File name contains non-latin characters, attempt to slug the value
*/
if (!$this->validateFileName($fileName)) {
$extension = $uploadedFile->getClientOriginalExtension();
$fileNameWithoutExt = str_replace($extension, "", $fileName);
$fileName = str_slug($fileNameWithoutExt, "-").'.'.$extension;
$fileNameSlug = Str::slug(File::name($fileName), '-');
$fileName = $fileNameSlug.'.'.$extension;
}
// See mime type handling in the asset manager
if (!$uploadedFile->isValid()) {