fix(admin): 统一jpe/jpeg扩展名为jpg

检测到文件MIME类型对应的扩展名为jpe或jpeg时,统一转换为更常见的jpg格式,确保后续文件路径处理的一致性。
This commit is contained in:
augushong
2026-05-02 22:10:42 +08:00
parent 45efbc24f6
commit c179ed27f1

View File

@@ -104,6 +104,11 @@ class File extends Common
$mime_type = $mime_detector->detectMimeTypeFromBuffer($file_data);
$ext_name = array_search($mime_type, GeneratedExtensionToMimeTypeMap::MIME_TYPES_FOR_EXTENSIONS);
// jpe/jpeg 统一为更常见的 jpg
if ($ext_name === 'jpe' || $ext_name === 'jpeg') {
$ext_name = 'jpg';
}
$public_file_path = '/temp_img/' . uniqid() . '.' . $ext_name;
$temp_file = App::getRootPath() . 'public' . $public_file_path;