gitlab-org--gitlab-foss/app/controllers/admin/requests_profiles_controller.rb
Stan Hu 4ac4ba2654 Fix requests profiler in admin page not rendering HTML properly
By default in Rails 5, content passed to `render` will be
escaped. This doesn't work for the HTML profile output, which
should be considered safe HTML already.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56152
2019-01-09 23:09:43 -08:00

19 lines
564 B
Ruby

# frozen_string_literal: true
class Admin::RequestsProfilesController < Admin::ApplicationController
def index
@profile_token = Gitlab::RequestProfiler.profile_token
@profiles = Gitlab::RequestProfiler::Profile.all.group_by(&:request_path)
end
def show
clean_name = Rack::Utils.clean_path_info(params[:name])
profile = Gitlab::RequestProfiler::Profile.find(clean_name)
if profile
render html: profile.content.html_safe
else
redirect_to admin_requests_profiles_path, alert: 'Profile not found'
end
end
end