MCPcopy Create free account
hub / github.com/aptly-dev/aptly / apiFilesDeleteDir

Function apiFilesDeleteDir

api/files.go:317–329  ·  view source on GitHub ↗

@Summary Delete Directory @Description **Delete upload directory and uploaded files within** @Description @Description **Example:** @Description ``` @Description $ curl -X DELETE http://localhost:8080/api/files/aptly-0.9 @Description {} @Description ``` @Tags Files @Produce json @Param dir path st

(c *gin.Context)

Source from the content-addressed store, hash-verified

315// @Failure 500 {object} Error "Internal Server Error"
316// @Router /api/files/{dir} [delete]
317func apiFilesDeleteDir(c *gin.Context) {
318 if !verifyDir(c) {
319 return
320 }
321
322 err := os.RemoveAll(filepath.Join(context.UploadPath(), utils.SanitizePath(c.Params.ByName("dir"))))
323 if err != nil {
324 AbortWithJSONError(c, 500, err)
325 return
326 }
327
328 c.JSON(200, gin.H{})
329}
330
331// @Summary Delete File
332// @Description **Delete a uploaded file in upload directory**

Callers

nothing calls this directly

Calls 5

SanitizePathFunction · 0.92
verifyDirFunction · 0.85
AbortWithJSONErrorFunction · 0.85
UploadPathMethod · 0.80
ByNameMethod · 0.45

Tested by

no test coverage detected