Improve handling of file params in lograge.

This commit is contained in:
Guo Xiang Tan 2018-07-19 08:23:59 +08:00
parent a755ff7b35
commit 9b18ee4bba
1 changed files with 10 additions and 1 deletions

View File

@ -46,7 +46,16 @@ if (Rails.env.production? && SiteSetting.logging_provider == 'lograge') || ENV["
exceptions = %w(controller action format id)
params = event.payload[:params].except(*exceptions)
params[:files].map!(&:headers) if params[:files]
if (file = params[:file]) && file.respond_to?(:headers)
param[:file] = file.headers
end
if (files = params[:files])
params[:files] = files.map do |file|
file.respond_to?(:headers) ? file.headers : file
end
end
output = {
params: params.to_query,