From 586ebb5059f2083901667cb1fe7c5c22cf9798ac Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Tue, 16 Aug 2022 20:50:26 +0200 Subject: [PATCH] return after redirects to web representation (#755) --- internal/api/s2s/user/followers.go | 1 + internal/api/s2s/user/following.go | 1 + internal/api/s2s/user/outboxget.go | 1 + internal/api/s2s/user/publickeyget.go | 1 + internal/api/s2s/user/repliesget.go | 1 + internal/api/s2s/user/statusget.go | 1 + internal/api/s2s/user/userget.go | 1 + 7 files changed, 7 insertions(+) diff --git a/internal/api/s2s/user/followers.go b/internal/api/s2s/user/followers.go index 77c0e1307..675688311 100644 --- a/internal/api/s2s/user/followers.go +++ b/internal/api/s2s/user/followers.go @@ -48,6 +48,7 @@ func (m *Module) FollowersGETHandler(c *gin.Context) { if format == string(api.TextHTML) { // redirect to the user's profile c.Redirect(http.StatusSeeOther, "/@"+requestedUsername) + return } resp, errWithCode := m.processor.GetFediFollowers(transferContext(c), requestedUsername, c.Request.URL) diff --git a/internal/api/s2s/user/following.go b/internal/api/s2s/user/following.go index 14dc9343f..d4404ea08 100644 --- a/internal/api/s2s/user/following.go +++ b/internal/api/s2s/user/following.go @@ -48,6 +48,7 @@ func (m *Module) FollowingGETHandler(c *gin.Context) { if format == string(api.TextHTML) { // redirect to the user's profile c.Redirect(http.StatusSeeOther, "/@"+requestedUsername) + return } resp, errWithCode := m.processor.GetFediFollowing(transferContext(c), requestedUsername, c.Request.URL) diff --git a/internal/api/s2s/user/outboxget.go b/internal/api/s2s/user/outboxget.go index 568e48017..a146cd551 100644 --- a/internal/api/s2s/user/outboxget.go +++ b/internal/api/s2s/user/outboxget.go @@ -99,6 +99,7 @@ func (m *Module) OutboxGETHandler(c *gin.Context) { if format == string(api.TextHTML) { // redirect to the user's profile c.Redirect(http.StatusSeeOther, "/@"+requestedUsername) + return } var page bool diff --git a/internal/api/s2s/user/publickeyget.go b/internal/api/s2s/user/publickeyget.go index e929c461d..265c01ee5 100644 --- a/internal/api/s2s/user/publickeyget.go +++ b/internal/api/s2s/user/publickeyget.go @@ -52,6 +52,7 @@ func (m *Module) PublicKeyGETHandler(c *gin.Context) { if format == string(api.TextHTML) { // redirect to the user's profile c.Redirect(http.StatusSeeOther, "/@"+requestedUsername) + return } resp, errWithCode := m.processor.GetFediUser(transferContext(c), requestedUsername, c.Request.URL) diff --git a/internal/api/s2s/user/repliesget.go b/internal/api/s2s/user/repliesget.go index 6ef5a5f43..86a57e692 100644 --- a/internal/api/s2s/user/repliesget.go +++ b/internal/api/s2s/user/repliesget.go @@ -113,6 +113,7 @@ func (m *Module) StatusRepliesGETHandler(c *gin.Context) { if format == string(api.TextHTML) { // redirect to the status c.Redirect(http.StatusSeeOther, "/@"+requestedUsername+"/statuses/"+requestedStatusID) + return } var page bool diff --git a/internal/api/s2s/user/statusget.go b/internal/api/s2s/user/statusget.go index b6690c4de..3e3d6ea56 100644 --- a/internal/api/s2s/user/statusget.go +++ b/internal/api/s2s/user/statusget.go @@ -56,6 +56,7 @@ func (m *Module) StatusGETHandler(c *gin.Context) { if format == string(api.TextHTML) { // redirect to the status c.Redirect(http.StatusSeeOther, "/@"+requestedUsername+"/statuses/"+requestedStatusID) + return } resp, errWithCode := m.processor.GetFediStatus(transferContext(c), requestedUsername, requestedStatusID, c.Request.URL) diff --git a/internal/api/s2s/user/userget.go b/internal/api/s2s/user/userget.go index b5e8a84c9..508c8be7d 100644 --- a/internal/api/s2s/user/userget.go +++ b/internal/api/s2s/user/userget.go @@ -56,6 +56,7 @@ func (m *Module) UsersGETHandler(c *gin.Context) { if format == string(api.TextHTML) { // redirect to the user's profile c.Redirect(http.StatusSeeOther, "/@"+requestedUsername) + return } resp, errWithCode := m.processor.GetFediUser(transferContext(c), requestedUsername, c.Request.URL)