Block request if not enough space is available

This commit is contained in:
Dane Everitt 2020-07-11 13:16:12 -07:00
parent c1e591c99b
commit daf401e326
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -202,6 +202,13 @@ func postServerCompressFiles(c *gin.Context) {
return return
} }
if !s.Filesystem.HasSpaceAvailable() {
c.AbortWithStatusJSON(http.StatusConflict, gin.H{
"error": "This server does not have enough available disk space to generate a compressed archive.",
})
return
}
f, err := s.Filesystem.CompressFiles(data.RootPath, data.Paths) f, err := s.Filesystem.CompressFiles(data.RootPath, data.Paths)
if err != nil { if err != nil {
TrackedServerError(err, s).AbortWithServerError(c) TrackedServerError(err, s).AbortWithServerError(c)