Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-03 11:29:35 +03:00
parent c57c04e12a
commit 3a574bff6c

View File

@@ -7,7 +7,9 @@ import (
"bytes"
"database/sql"
"fmt"
"log"
"net/http"
"runtime/debug"
"sort"
"strconv"
"strings"
@@ -36,6 +38,13 @@ type balanceSummaryPDF struct {
func ExportCustomerBalancePDFHandler(_ *sql.DB) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
defer func() {
if rec := recover(); rec != nil {
log.Printf("PANIC ExportCustomerBalancePDFHandler: %v\n%s", rec, string(debug.Stack()))
http.Error(w, "internal server error", http.StatusInternalServerError)
}
}()
claims, ok := auth.GetClaimsFromContext(r.Context())
if !ok || claims == nil {
http.Error(w, "unauthorized", http.StatusUnauthorized)