fix: remove ContentLength from presigned URL, fix macOS multi-select

- ContentLength in PutObjectCommand causes XHR upload failures (browser
  does not send matching Content-Length header in presigned PUT requests)
- Change accept to audio/* so macOS Finder allows multi-file selection
- Add step prefix to errors ([URL]/[S3]/[DB]) for easier debugging

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Robin Choice
2026-04-13 18:30:50 +02:00
parent 9530add1ff
commit e63dc30a7f
2 changed files with 13 additions and 10 deletions

View File

@@ -21,13 +21,12 @@ const bucket = process.env.S3_BUCKET!;
export async function createUploadUrl(
key: string,
contentType: string,
maxSize: number,
_maxSize?: number,
): Promise<string> {
const command = new PutObjectCommand({
Bucket: bucket,
Key: key,
ContentType: contentType,
ContentLength: maxSize,
});
return getSignedUrl(s3, command, { expiresIn: 900 }); // 15 min
}