Skip to content

Delete package file API

Steve Abrams requested to merge 32107-delete-package-file-api into master

What does this MR do?

This adds a new endpoint to the API to delete package files:

DELETE /projects/:id/packages/:package_id/package_files/:package_file_id

Screenshots (strongly suggested)

Deleting a package file:

→ curl --request DELETE -i --header "PRIVATE-TOKEN: $TOKEN" "http://gdk.test:3001/api/v4/projects/16/packages/3/package_files/3"
HTTP/1.1 204 No Content

When file does not exist:

→ curl --request DELETE --header "PRIVATE-TOKEN: $TOKEN" "http://gdk.test:3001/api/v4/projects/16/packages/1/package_files/1"
{"message":"404 Not Found"}

Without permissions to access project/package:

curl --header "PRIVATE-TOKEN: $TOKEN" "http://gdk.test:3001/api/v4/projects/16/packages/3/package_files/3"
{"error":"404 Not Found"}

Without authorization to delete file:

curl --header "PRIVATE-TOKEN: $TOKEN" "http://gdk.test:3001/api/v4/projects/16/packages/3/package_files/3"
{"error":"403 Forbidden"}

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Related to #32107 (closed)

Edited by Steve Abrams

Merge request reports