From 0ac845042e14c85934f02ecef2696e1a8651663e Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 20 Dec 2021 17:18:26 +0000 Subject: Move POST /{username}/action/{action} to simply POST /{username} (#18045) The current code unfortunately requires that `action` be a reserved repository name as it prevents posts to change the settings for action repositories. However, we can simply change action handler to work on POST /{username} instead. Fix #18037 Signed-off-by: Andrew Thornton --- routers/web/user/profile.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'routers/web/user') diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go index 77b357c222..40fc44ed14 100644 --- a/routers/web/user/profile.go +++ b/routers/web/user/profile.go @@ -363,7 +363,7 @@ func Action(ctx *context.Context) { } var err error - switch ctx.Params(":action") { + switch ctx.FormString("action") { case "follow": err = user_model.FollowUser(ctx.User.ID, u.ID) case "unfollow": @@ -371,7 +371,7 @@ func Action(ctx *context.Context) { } if err != nil { - ctx.ServerError(fmt.Sprintf("Action (%s)", ctx.Params(":action")), err) + ctx.ServerError(fmt.Sprintf("Action (%s)", ctx.FormString("action")), err) return } // FIXME: We should check this URL and make sure that it's a valid Gitea URL -- cgit v1.2.3