Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force html processing for all formats except html, js and json #10874

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/api/app/controllers/webui/package_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class Webui::PackageController < Webui::WebuiController

after_action :verify_authorized, only: [:new, :create, :remove_file, :remove, :abort_build, :trigger_rebuild, :wipe_binaries, :save_meta, :save, :abort_build]

before_action :force_html_mime_type

def index
render json: PackageDatatable.new(params, view_context: view_context, project: @project)
end
Expand Down Expand Up @@ -896,4 +898,8 @@ def set_job_status
@buildtime = nil
end
end

def force_html_mime_type
request.format = :html unless [:html, :js, :json].include?(request.format.to_sym)
end
end
5 changes: 4 additions & 1 deletion src/api/config/routes/webui_routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@
end
end

controller 'webui/package' do
get 'package/show/:project/:package' => :show, as: 'package_show', constraints: cons
end

defaults format: 'html' do
controller 'webui/package' do
get 'package/show/:project/:package' => :show, as: 'package_show', constraints: cons
get 'package/branch_diff_info/:project/:package' => :branch_diff_info, as: 'package_branch_diff_info', constraints: cons
get 'package/dependency/:project/:package' => :dependency, constraints: cons, as: 'package_dependency'
get 'package/binary/:project/:package/:repository/:arch/:filename' => :binary, constraints: cons, as: 'package_binary'
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading