Project

General

Profile

Bug #594 » cookie_overflow.patch

liaham, 11/17/2021 07:37 PM

View differences:

app/helpers/queries_helper.rb
# Retrieve query from session or build a new query
def retrieve_query(klass=IssueQuery, use_session=true, options={})
use_session = use_session_allowed? if use_session # this line is added by xmera
session_key = klass.name.underscore.to_sym
if params[:query_id].present?
......
@query
end
# Check whether the string byte size is below the configured threshold.
#
# @note This method is added by xmera.
#
def use_session_allowed?
request.query_string.bytesize < Rails.application.config.max_query_string_size
end
def retrieve_query_from_session(klass=IssueQuery)
session_key = klass.name.underscore.to_sym
session_data = session[session_key]
config/application.rb
:same_site => :lax
)
# Redmine stores query data in a session cookie in order to persist
# the last user query. This is havily used for issue queries.
# All the information configured for an issue query are appended to the url.
# The appendix is called query string. If this query string is to large for
# current the session cookie rails will raise an
# ActionDispatch::Cookies::CookieOverflow exception. Therefore, the byte
# size of a query string is limited to 30% of the maximum byte size of 4kb
# for a cookie.
# That is, query strings greater than the threshold won't be stored in order
# to avoid the exception.
# You can configure this value for your needs.
#
# @note This parameter is added by xmera.
#
if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
end
(3-3/3)