Fix Web UI being inaccessible with URLs ending with .zip (#40134)
This commit is contained in:
parent
118843b441
commit
7a5a849e66
@ -6,6 +6,7 @@ module WebAppControllerConcern
|
|||||||
included do
|
included do
|
||||||
vary_by 'Accept, Accept-Language, Cookie'
|
vary_by 'Accept, Accept-Language, Cookie'
|
||||||
|
|
||||||
|
before_action :adjust_format_for_zip_tlds
|
||||||
before_action :redirect_unauthenticated_to_permalinks!
|
before_action :redirect_unauthenticated_to_permalinks!
|
||||||
before_action :set_referer_header
|
before_action :set_referer_header
|
||||||
before_action :redirect_to_tos_interstitial!
|
before_action :redirect_to_tos_interstitial!
|
||||||
@ -46,6 +47,14 @@ module WebAppControllerConcern
|
|||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
# This endpoint will never serve zip files, but may serve paths ending with `.zip` due to the `.zip` TLD.
|
||||||
|
# When that happens from a browser, Rails will unfortunately determine the requested format to be `:zip`
|
||||||
|
# instead of `:html`, so override this.
|
||||||
|
# We don't just override `format` in all cases, because we want to handle `:json` as well.
|
||||||
|
def adjust_format_for_zip_tlds
|
||||||
|
request.format = :html if request.format == :zip
|
||||||
|
end
|
||||||
|
|
||||||
def redirect_to_tos_interstitial!
|
def redirect_to_tos_interstitial!
|
||||||
return unless current_user&.require_tos_interstitial?
|
return unless current_user&.require_tos_interstitial?
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user