From eb0946fadab35aea259ee7fe5b4e8d9042323211 Mon Sep 17 00:00:00 2001 From: jholdstock Date: Wed, 24 Jun 2020 10:30:30 +0100 Subject: [PATCH] Don't write http body on db write error --- webapi/admin.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webapi/admin.go b/webapi/admin.go index 073568c..4fa9496 100644 --- a/webapi/admin.go +++ b/webapi/admin.go @@ -65,7 +65,9 @@ func downloadDatabaseBackup(c *gin.Context) { err := db.BackupDB(c.Writer) if err != nil { log.Errorf("Error backing up database: %v", err) - c.String(http.StatusInternalServerError, "Error backing up database") + // Don't write any http body here because Content-Length has already + // been set in db.BackupDB. Status is enough to indicate an error. + c.Status(http.StatusInternalServerError) } }