summaryrefslogtreecommitdiff
path: root/internal/api/activitypub/users/userget.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/api/activitypub/users/userget.go')
-rw-r--r--internal/api/activitypub/users/userget.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/internal/api/activitypub/users/userget.go b/internal/api/activitypub/users/userget.go
index 00d8a0f1f..9841e08d6 100644
--- a/internal/api/activitypub/users/userget.go
+++ b/internal/api/activitypub/users/userget.go
@@ -38,8 +38,8 @@ import (
// request is blocked.
func (m *Module) UsersGETHandler(c *gin.Context) {
// usernames on our instance are always lowercase
- requestedUsername := strings.ToLower(c.Param(UsernameKey))
- if requestedUsername == "" {
+ requestedUser := strings.ToLower(c.Param(apiutil.UsernameKey))
+ if requestedUser == "" {
err := errors.New("no username specified in request")
apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1)
return
@@ -51,13 +51,17 @@ func (m *Module) UsersGETHandler(c *gin.Context) {
return
}
+ // If HTML is requested, redirect
+ // to user's profile instead.
if contentType == string(apiutil.TextHTML) {
- // redirect to the user's profile
- c.Redirect(http.StatusSeeOther, "/@"+requestedUsername)
+ c.Redirect(http.StatusSeeOther, "/@"+requestedUser)
return
}
- resp, errWithCode := m.processor.Fedi().UserGet(c.Request.Context(), requestedUsername, c.Request.URL)
+ resp, errWithCode := m.processor.Fedi().UserGet(
+ c.Request.Context(),
+ requestedUser,
+ )
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return