Fixed AMF controller to validate changeset comments

Fixed AMF controller so that it doesn't accept non-UTF8 comments, and
throws away non-XML characters.
This commit is contained in:
Matt Amos 2010-08-08 15:47:55 +01:00 committed by Tom Hughes
parent 13c60137c2
commit 838b1ee7e9
2 changed files with 30 additions and 1 deletions

View file

@ -529,6 +529,24 @@ class AmfControllerTest < ActionController::TestCase
end
def test_startchangeset_invalid_xmlchar_comment
invalid = "\035\022"
comment = "foo#{invalid}bar"
amf_content "startchangeset", "/1", ["test@example.com:test", Hash.new, nil, comment, 1]
post :amf_write
assert_response :success
amf_parse_response
result = amf_result("/1")
assert_equal 3, result.size, result.inspect
assert_equal 0, result[0]
new_cs_id = result[2]
cs = Changeset.find(new_cs_id)
assert_equal "foobar", cs.tags["comment"]
end
# ************************************************************
# AMF Helper functions