Support unarching in a better fashion with zip-slip protections and size checking

This commit is contained in:
Dane Everitt
2020-07-15 21:16:08 -07:00
parent ae46add8ef
commit a635cdd6b2
3 changed files with 183 additions and 40 deletions

View File

@@ -290,9 +290,15 @@ func postServerDecompressFiles(c *gin.Context) {
return
}
if !s.Filesystem.HasSpaceAvailable() {
hasSpace, err := s.Filesystem.SpaceAvailableForDecompression(data.RootPath, data.File)
if err != nil {
TrackedServerError(err, s).AbortWithServerError(c)
return
}
if !hasSpace {
c.AbortWithStatusJSON(http.StatusConflict, gin.H{
"error": "This server does not have enough available disk space to decompress an archive.",
"error": "This server does not have enough available disk space to decompress this archive.",
})
return
}