diff --git a/go_cloud/internal/http/routes.go b/go_cloud/internal/http/routes.go index 3a4f132..5abbcbd 100644 --- a/go_cloud/internal/http/routes.go +++ b/go_cloud/internal/http/routes.go @@ -3174,8 +3174,12 @@ func publicFileViewHandler(w http.ResponseWriter, r *http.Request, db *database. return } + // Create context with longer timeout for file downloads + downloadCtx, cancel := context.WithTimeout(r.Context(), 5*time.Minute) + defer cancel() + // Stream file - resp, err := client.Download(r.Context(), file.Path, r.Header.Get("Range")) + resp, err := client.Download(downloadCtx, file.Path, r.Header.Get("Range")) if err != nil { errors.LogError(r, err, "Failed to download file") errors.WriteError(w, errors.CodeInternal, "Server error", http.StatusInternalServerError)