Don't write http body on db write error

This commit is contained in:
jholdstock 2020-06-24 10:30:30 +01:00 committed by David Hill
parent 5e8ef4e7f2
commit eb0946fada

View File

@ -65,7 +65,9 @@ func downloadDatabaseBackup(c *gin.Context) {
err := db.BackupDB(c.Writer) err := db.BackupDB(c.Writer)
if err != nil { if err != nil {
log.Errorf("Error backing up database: %v", err) 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)
} }
} }