Throw error if empty files

This commit is contained in:
Dane Everitt 2020-07-11 13:38:25 -07:00
parent 2cef055ff2
commit 7147f477e2
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
}
if len(data.Files) == 0 {
c.AbortWithStatusJSON(http.StatusUnprocessableEntity, gin.H{
"error": "No files were passed through to be compressed.",
})
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.",