From e91cabb704b1cfc1cae438f5be8600e83dc5578e Mon Sep 17 00:00:00 2001 From: Daenney Date: Tue, 16 May 2023 15:08:45 +0200 Subject: [bugfix] Fix NegotiateFormat with multiple accept headers (#1797) * [bugfix] Fix NegotiateAccept with multi accept There's a bug in Gin's NegotiateFormat that doesn't handle the presence of multilpe accept headers. This lifts the code from the PR @tsmethurst sent a year ago to Gin into our codebase to fix the issue. * [bugfix] Concat accept header in webfinger Some implementations bug out when there's multiple accept headers, including Gin (see 7050112af1ccc935ec542cb41fa8b07f7357539d). But things seem to work reliably with a single accept header with multiple parts. Fixes: #1793 --- internal/web/profile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'internal/web/profile.go') diff --git a/internal/web/profile.go b/internal/web/profile.go index a4fddbafe..56f8e0a56 100644 --- a/internal/web/profile.go +++ b/internal/web/profile.go @@ -73,7 +73,7 @@ func (m *Module) profileGETHandler(c *gin.Context) { // if we're getting an AP request on this endpoint we // should render the account's AP representation instead - accept := c.NegotiateFormat(string(apiutil.TextHTML), string(apiutil.AppActivityJSON), string(apiutil.AppActivityLDJSON)) + accept := apiutil.NegotiateFormat(c, string(apiutil.TextHTML), string(apiutil.AppActivityJSON), string(apiutil.AppActivityLDJSON)) if accept == string(apiutil.AppActivityJSON) || accept == string(apiutil.AppActivityLDJSON) { m.returnAPProfile(ctx, c, username, accept) return -- cgit v1.2.3