fix:음성파일 다운로드 한글 파일명 및 확장자 수정
- Str::slug()이 한글을 제거하는 문제 수정 - 한글 파일명 그대로 유지 (파일시스템 금지문자만 치환) - RFC 5987 filename*=UTF-8'' 헤더로 브라우저 호환성 확보 - 다운로드 파일명 예시: 무제 음성녹음.webm Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -253,11 +253,14 @@ public function download(int $id): Response|JsonResponse
|
||||
// 파일 확장자 추출
|
||||
$extension = pathinfo($recording->audio_file_path, PATHINFO_EXTENSION) ?: 'webm';
|
||||
|
||||
// 파일명 생성 (제목 기반, URL 안전하게)
|
||||
$filename = Str::slug($recording->title ?: 'recording').'.'. $extension;
|
||||
// 파일명 생성 (한글 제목 지원)
|
||||
$title = $recording->title ?: 'recording';
|
||||
$safeTitle = preg_replace('/[\/\\\\:*?"<>|]/', '_', $title);
|
||||
$filename = $safeTitle.'.'.$extension;
|
||||
$encodedFilename = rawurlencode($filename);
|
||||
|
||||
return response($content)
|
||||
->header('Content-Type', 'audio/'.$extension)
|
||||
->header('Content-Disposition', 'attachment; filename="'.$filename.'"');
|
||||
->header('Content-Disposition', "attachment; filename=\"{$encodedFilename}\"; filename*=UTF-8''{$encodedFilename}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user