This commit is contained in:
Matthew Penner
2020-09-20 12:51:12 -06:00
parent aa39cefcf1
commit ff597672db
8 changed files with 50 additions and 13 deletions

View File

@@ -327,6 +327,16 @@ func postServerDecompressFiles(c *gin.Context) {
hasSpace, err := s.Filesystem.SpaceAvailableForDecompression(data.RootPath, data.File)
if err != nil {
// Handle an unknown format error.
if errors.Is(err, server.ErrUnknownArchiveFormat) {
s.Log().WithField("error", err).Warn("failed to decompress file due to unknown format")
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{
"error": "unknown archive format",
})
return
}
TrackedServerError(err, s).AbortWithServerError(c)
return
}

View File

@@ -38,9 +38,9 @@ type Handler struct {
}
var (
ErrJwtNotPresent = errors.New("jwt: no jwt present")
ErrJwtNotPresent = errors.New("jwt: no jwt present")
ErrJwtNoConnectPerm = errors.New("jwt: missing connect permission")
ErrJwtUuidMismatch = errors.New("jwt: server uuid mismatch")
ErrJwtUuidMismatch = errors.New("jwt: server uuid mismatch")
)
func IsJwtError(err error) bool {