This commit is contained in:
freedakgmail
2025-12-10 13:03:10 +08:00
parent 47be495fcf
commit e7167f4340
153 changed files with 1155 additions and 458 deletions
+8
View File
@@ -24,12 +24,20 @@ export async function GET(
// 根据文件扩展名设置 Content-Type
const ext = filename.split('.').pop()?.toLowerCase()
const contentTypeMap: Record<string, string> = {
// 图片
'jpg': 'image/jpeg',
'jpeg': 'image/jpeg',
'png': 'image/png',
'gif': 'image/gif',
'webp': 'image/webp',
'svg': 'image/svg+xml',
// 视频
'mp4': 'video/mp4',
'webm': 'video/webm',
'ogg': 'video/ogg',
'mov': 'video/quicktime',
'avi': 'video/x-msvideo',
'mkv': 'video/x-matroska',
}
const contentType = contentTypeMap[ext || ''] || 'application/octet-stream'