Skip to content

Commit

Permalink
[webui] Fix rpmlint rendering
Browse files Browse the repository at this point in the history
Introduced by changing the rendering method in bdfb287.
HTML got escaped so moved to a dedicated view.
Fixes #2552.
  • Loading branch information
ChrisBr committed Jan 17, 2017
1 parent f113935 commit e4db4ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/api/app/controllers/webui/package_controller.rb
Expand Up @@ -990,19 +990,9 @@ def get_rpmlint_log(project, package, repository, architecture)
def rpmlint_log
required_parameters :project, :package, :repository, :architecture
begin
rpmlint_log = get_rpmlint_log(params[:project], params[:package], params[:repository], params[:architecture])
rpmlint_log.encode!(xml: :text)
res = ''
rpmlint_log.lines.each do |line|
if line.match(/\w+(?:\.\w+)+: W: /)
res += "<span style=\"color: olive;\">#{line}</span>"
elsif line.match(/\w+(?:\.\w+)+: E: /)
res += "<span style=\"color: red;\">#{line}</span>"
else
res += line
end
end
render html: res
@log = get_rpmlint_log(params[:project], params[:package], params[:repository], params[:architecture])
@log.encode!(xml: :text)
render partial: 'rpmlint_log'
rescue ActiveXML::Transport::NotFoundError
render plain: 'No rpmlint log'
end
Expand Down
7 changes: 7 additions & 0 deletions src/api/app/views/webui/package/rpmlint_log.html.haml
@@ -0,0 +1,7 @@
- @log.lines.each do |line|
- if line.match(/\w+(?:\.\w+)+: W: /)
= content_tag(:span, line.strip, style: 'color: olive;')
- elsif line.match(/\w+(?:\.\w+)+: E: /)
= content_tag(:span, line.strip, style: 'color: red;')
- else
= line.strip

0 comments on commit e4db4ea

Please sign in to comment.