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:
@@ -719,6 +719,14 @@ func (s *Server) handlePresignAudio(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
key := s.store.AudioObjectKey(slug, n, voice, speed)
|
||||
|
||||
// Return 404 when the object hasn't been uploaded yet — the client treats
|
||||
// this as "audio not ready" and will either poll or trigger generation.
|
||||
if !s.store.AudioExists(r.Context(), key) {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
url, err := s.store.PresignAudio(r.Context(), key, 1*time.Hour)
|
||||
if err != nil {
|
||||
s.log.Error("presign audio failed", "slug", slug, "n", n, "err", err)
|
||||
|
||||
Reference in New Issue
Block a user