Skip to content

Delete a gist with POST instead of GET - #199

Merged
takezoe merged 1 commit into
gitbucket:masterfrom
aadrian:fix-gist-delete-post
Oct 29, 2026
Merged

takezoe merged 1 commit into
gitbucket:masterfrom
aadrian:fix-gist-delete-post

Conversation

@aadrian

@aadrian aadrian commented Oct 28, 2026

Copy link
Copy Markdown
Member

GET /gist/:userName/:repoName/delete deletes the gist, so a link or image on another page can delete a signed-in user's gist. gitbucket/gitbucket#4166 changes the same kind of routes in core to POST. This PR does it for the gist delete.

Route Before After
/gist/:userName/:repoName/delete GET POST

UI: the Delete button in the gist header (gist page, revisions, forks) and on the edit page submits a hidden POST form after the confirm dialog, the same way the Fork button already submits its form. The confirm handler moved from detail.scala.html into header.scala.html, so the revisions and forks pages now ask for confirmation too (before, Delete there deleted at once).

Tests (no test suite in this plugin): 4.48.0 with this build of the plugin, Firefox and Chrome:

  • Opening the old URL directly leaves the gist in place.
  • Delete on the gist page, revisions, forks and edit page: cancel leaves the gist, OK sends a POST, deletes the gist and goes to the user's gist list.
  • No new JavaScript errors.

@takezoe
takezoe merged commit 0d26e38 into gitbucket:master Oct 29, 2026
1 check passed
@aadrian
aadrian deleted the fix-gist-delete-post branch October 29, 2026 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants