(ctx *gin.Context)
| 147 | } |
| 148 | |
| 149 | func DeleteFileHandler(ctx *gin.Context) { |
| 150 | relativePath := ctx.Query("path") |
| 151 | removePath := path.Join(dir.UserDataDir, relativePath) |
| 152 | err := os.RemoveAll(removePath) |
| 153 | if err != nil { |
| 154 | errMsg := fmt.Sprintf("Remove %s Error: %s", removePath, err.Error()) |
| 155 | logrus.Errorf(errMsg) |
| 156 | resp := ginmodel.JsonResp{ |
| 157 | Code: -1, |
| 158 | Message: errMsg, |
| 159 | Data: nil, |
| 160 | } |
| 161 | ctx.JSON(http.StatusInternalServerError, resp) |
| 162 | return |
| 163 | } |
| 164 | resp := ginmodel.JsonResp{ |
| 165 | Code: 0, |
| 166 | Message: "success", |
| 167 | Data: nil, |
| 168 | } |
| 169 | ctx.JSON(http.StatusOK, resp) |
| 170 | } |
| 171 | |
| 172 | func DownloadFileHandler(ctx *gin.Context) { |
| 173 | relativePath := ctx.Query("path") |
nothing calls this directly
no outgoing calls
no test coverage detected