Skip to content
This repository was archived by the owner on Aug 22, 2021. It is now read-only.

Commit a9f5a94

Browse files
committed
Fix filename strategy. overtrue#19
1 parent 1fb3134 commit a9f5a94

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/StorageManager.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,11 @@ protected function fileHasError(UploadedFile $file, array $config)
161161
*/
162162
protected function getFilename(UploadedFile $file, array $config)
163163
{
164-
$ext = '.'.($file->guessClientExtension() ?: $file->getClientOriginalExtension());
164+
$ext = '.'.$file->getClientOriginalExtension();
165165

166-
return str_finish($this->formatPath($config['path_format']), '/').md5($file->getFilename()).$ext;
166+
$filename = config('ueditor.hash_filename') ? md5($file->getFilename()).$ext : $file->getClientOriginalName();
167+
168+
return str_finish($this->formatPath($config['path_format']), '/').$filename;
167169
}
168170

169171
/**

src/config/ueditor.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
],
1818
],
1919

20+
// 是否使用 md5 格式文件名
21+
'hash_filename' => true,
22+
2023
// 上传 配置
2124
'upload' => [
2225
/* 前后端通信相关的配置,注释只允许使用多行方式 */

0 commit comments

Comments
 (0)