admin: Can gunzip files
This commit is contained in:
parent
c082ee43d0
commit
a0cd651dae
4 changed files with 83 additions and 3 deletions
|
|
@ -37,6 +37,7 @@ func declareFilesRoutes(router *gin.RouterGroup) {
|
|||
|
||||
// Check
|
||||
apiFilesRoutes.POST("/check", checkFile)
|
||||
apiFilesRoutes.POST("/gunzip", gunzipFile)
|
||||
}
|
||||
|
||||
func FileHandler(c *gin.Context) {
|
||||
|
|
@ -266,3 +267,15 @@ func checkFile(c *gin.Context) {
|
|||
|
||||
c.JSON(http.StatusOK, true)
|
||||
}
|
||||
|
||||
func gunzipFile(c *gin.Context) {
|
||||
file := c.MustGet("file").(*fic.EFile)
|
||||
|
||||
err := file.GunzipFileOnDisk()
|
||||
if err != nil {
|
||||
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, true)
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue