Skip to content

Commit

Permalink
Prevent invalid xml output of null characters
Browse files Browse the repository at this point in the history
Prevent the xml renderer from throwing a 500 internal server error:

ActionView::Template::Error (string contains null byte)

Co-authored-by: Victor Pereira <vpereira@suse.com>
  • Loading branch information
eduardoj and vpereira committed Sep 18, 2018
1 parent 9277beb commit 76f9212
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/api/app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def to_xml(builder, include_commentable = false)
attrs['project'] = commentable.project if commentable.is_a?(Package)
end
attrs[:parent] = parent_id if parent_id
body.delete!("\u0000")

builder.comment_(attrs) do
builder.text(body)
Expand Down

0 comments on commit 76f9212

Please sign in to comment.