From daf401e3260b0ee9eecfea44f65aac1c6db88845 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 11 Jul 2020 13:16:12 -0700 Subject: [PATCH] Block request if not enough space is available --- router/router_server_files.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/router/router_server_files.go b/router/router_server_files.go index 5384049..3729e97 100644 --- a/router/router_server_files.go +++ b/router/router_server_files.go @@ -202,6 +202,13 @@ func postServerCompressFiles(c *gin.Context) { 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) if err != nil { TrackedServerError(err, s).AbortWithServerError(c)