Skip to content

Commit

Permalink
[api] Fix broken /source/remote_link:project/_meta in Rails2.3 due to…
Browse files Browse the repository at this point in the history
… send_file streaming when not using use_xforward or x_rewrite_host in forward_from_backend
  • Loading branch information
lbt committed Nov 7, 2011
1 parent 2e51063 commit aa50e58
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/api/lib/opensuse/validator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'tempfile'
require 'stringio'

# This module encapsulates XML schema validation for individual controller actions.
# It allows to verify incoming and outgoing XML data and to set different schemas based
Expand Down Expand Up @@ -52,7 +53,14 @@ def validate_xml_response
opt[:method] = request.method.to_s
opt[:type] = "response"
if response.status.to_s == "200"
Suse::Validator.validate(opt, response.body.to_s)
if response.body.respond_to? :call
sio = StringIO.new()
response.body.call(nil, sio) # send_file can return a block that takes |response, output|
str = sio.string
else
str = response.body.to_s
end
Suse::Validator.validate(opt, str)
end
end

Expand Down

1 comment on commit aa50e58

@adrianschroeter
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merged this commit

Please sign in to comment.