diff options
author | 2023-06-19 10:58:58 +0300 | |
---|---|---|
committer | 2023-06-19 09:58:58 +0200 | |
commit | 73bfb5fbff53e920b7b87d937e4dfd8525f03be2 (patch) | |
tree | 5f94356196018662cd4f2a01fb565467b09df47e /internal/api/client/lists | |
parent | [chore]: Bump github.com/jackc/pgx/v5 from 5.3.1 to 5.4.1 (#1907) (diff) | |
download | gotosocial-73bfb5fbff53e920b7b87d937e4dfd8525f03be2.tar.xz |
[bugfix] Parse POST-style forms in the list member removal endpoint (#1903)
Diffstat (limited to 'internal/api/client/lists')
-rw-r--r-- | internal/api/client/lists/listaccountsremove.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/api/client/lists/listaccountsremove.go b/internal/api/client/lists/listaccountsremove.go index 6ce7e3cd3..5e8013741 100644 --- a/internal/api/client/lists/listaccountsremove.go +++ b/internal/api/client/lists/listaccountsremove.go @@ -100,7 +100,17 @@ func (m *Module) ListAccountsDELETEHandler(c *gin.Context) { } form := &apimodel.ListAccountsChangeRequest{} - if err := c.ShouldBind(form); err != nil { + + // XXX: Sending a body with a DELETE request is undefined. Ruby on Rails parses + // it fine. Go's (*http.Request).ParseForm only parses POST-style forms for POST, + // PUT, and PATCH request methods. Change the method until we're done with + // parsing in order to be compatible with Mastodon's client API conventions. + oldMethod := c.Request.Method + c.Request.Method = "POST" + err = c.ShouldBind(form) + c.Request.Method = oldMethod + + if err != nil { apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1) return } |