Config UI: set content-length for backup download (#23002)

This commit is contained in:
andig 2025-08-15 13:59:03 +02:00 • committed by GitHub
parent 6a29b41564
commit a32aceaad8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -379,6 +379,13 @@ func getBackup(authObject auth.Auth) http.HandlerFunc {
filename := "evcc-backup-" + time.Now().Format("2006-01-02--15-04") + ".db"
fi, err := f.Stat()
if err != nil {
http.Error(w, "Could not stat DB file: "+err.Error(), http.StatusInternalServerError)
return
}
w.Header().Set("Content-Length", strconv.FormatInt(fi.Size(), 10))
w.Header().Set("Content-Type", "application/octet-stream")
w.Header().Set("Content-Disposition", `attachment; filename="`+filename+`"`)