Check if pg_dump is available before running database export

This commit is contained in:
Dan Sosedoff
2018-04-25 23:29:18 -05:00
parent 7dce0fb4f4
commit e2be689a05
3 changed files with 17 additions and 1 deletions

View File

@@ -472,6 +472,13 @@ func DataExport(c *gin.Context) {
Table: strings.TrimSpace(c.Request.FormValue("table")),
}
// If pg_dump is not available the following code will not show an error in browser.
// This is due to the headers being written first.
if !dump.CanExport() {
c.JSON(400, Error{"pg_dump is not found"})
return
}
formattedInfo := info.Format()[0]
filename := formattedInfo["current_database"].(string)
if dump.Table != "" {