3a4cb6d675
It seems that we missed the backward compatibility support for profiles in the existing folder. This commit also fixes some specs to be idempotent and work in a temporary directory which not always seems to be the case. This commit also brings the profile_spec.rb which seems to be missing.
19 lines
631 B
Ruby
19 lines
631 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Admin::RequestsProfilesController < Admin::ApplicationController
|
|
def index
|
|
@profile_token = Gitlab::RequestProfiler.profile_token
|
|
@profiles = Gitlab::RequestProfiler.all.group_by(&:request_path)
|
|
end
|
|
|
|
def show
|
|
clean_name = Rack::Utils.clean_path_info(params[:name])
|
|
profile = Gitlab::RequestProfiler.find(clean_name)
|
|
|
|
unless profile && profile.content_type
|
|
return redirect_to admin_requests_profiles_path, alert: 'Profile not found'
|
|
end
|
|
|
|
send_file profile.file_path, type: "#{profile.content_type}; charset=utf-8", disposition: 'inline'
|
|
end
|
|
end
|