]> cat aescling's git repositories - mastodon.git/commitdiff
Fix account JSON/RSS not being cacheable due to wrong mime type comparison (#13116)
authorThibG <thib@sitedethib.com>
Wed, 19 Feb 2020 21:31:53 +0000 (22:31 +0100)
committerGitHub <noreply@github.com>
Wed, 19 Feb 2020 21:31:53 +0000 (22:31 +0100)
`request.format` is not a symbol but a `Mime::Type`, so the condition actually
never matched, and a session was created even for those requests, preventing
caching.

app/controllers/accounts_controller.rb

index 0a8015a5674c3d1dd5322c0927fef2ca4f291218..124393d62d2bb46c0f5603b7762984ee1a745016 100644 (file)
@@ -9,7 +9,7 @@ class AccountsController < ApplicationController
   before_action :set_cache_headers
   before_action :set_body_classes
 
-  skip_around_action :set_locale, if: -> { [:json, :rss].include?(request.format) }
+  skip_around_action :set_locale, if: -> { [:json, :rss].include?(request.format&.to_sym) }
   skip_before_action :require_functional!
 
   def show