fix(audio): return 404 from presign when audio object not yet uploaded
handlePresignAudio now checks AudioExists before presigning; previously it would generate a valid-looking signed URL for a non-existent object, causing the browser to get 404 from MinIO directly. - Add AudioExists to Store interface and HybridStore - Guard handlePresignAudio with AudioExists check, return 404 if missing - Propagate 404 through presignAudio() in minio.ts (typed error.status=404) - SvelteKit presign route forwards 404 to the browser instead of 500
This commit is contained in:
@@ -291,6 +291,10 @@ func (h *HybridStore) AudioObjectKey(slug string, n int, voice string, speed flo
|
||||
return AudioObjectKey(slug, n, voice, speed)
|
||||
}
|
||||
|
||||
func (h *HybridStore) AudioExists(ctx context.Context, key string) bool {
|
||||
return h.minio.AudioExists(ctx, key)
|
||||
}
|
||||
|
||||
// ─── PutAudio ─────────────────────────────────────────────────────────────────
|
||||
|
||||
func (h *HybridStore) PutAudio(ctx context.Context, key string, data []byte) error {
|
||||
|
||||
@@ -130,6 +130,8 @@ type Store interface {
|
||||
|
||||
// AudioObjectKey returns the MinIO object key for a cached audio file.
|
||||
AudioObjectKey(slug string, n int, voice string, speed float64) string
|
||||
// AudioExists returns true when the audio object is present in the bucket.
|
||||
AudioExists(ctx context.Context, key string) bool
|
||||
|
||||
// ── Presigned URLs ─────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user