{"action":"closed","issue":{"url":"https://api.github.com/repos/rails/rails/issues/16060","labels_url":"https://api.github.com/repos/rails/rails/issues/16060/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/16060/comments","events_url":"https://api.github.com/repos/rails/rails/issues/16060/events","html_url":"https://github.com/rails/rails/issues/16060","id":37194009,"number":16060,"title":"content_tag, when called with a block, isnt respecting `escape` parameter","user":{"login":"ktaragorn","id":2549496,"avatar_url":"https://avatars.githubusercontent.com/u/2549496?v=3","gravatar_id":"","url":"https://api.github.com/users/ktaragorn","html_url":"https://github.com/ktaragorn","followers_url":"https://api.github.com/users/ktaragorn/followers","following_url":"https://api.github.com/users/ktaragorn/following{/other_user}","gists_url":"https://api.github.com/users/ktaragorn/gists{/gist_id}","starred_url":"https://api.github.com/users/ktaragorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktaragorn/subscriptions","organizations_url":"https://api.github.com/users/ktaragorn/orgs","repos_url":"https://api.github.com/users/ktaragorn/repos","events_url":"https://api.github.com/users/ktaragorn/events{/privacy}","received_events_url":"https://api.github.com/users/ktaragorn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/actionview","name":"actionview","color":"d7e102"},{"url":"https://api.github.com/repos/rails/rails/labels/stale","name":"stale","color":"444444"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-07-05T07:25:22Z","updated_at":"2015-01-02T15:54:08Z","closed_at":"2015-01-02T15:54:08Z","body":"[content_tag](http://apidock.com/rails/v4.0.2/ActionView/Helpers/TagHelper/content_tag) when called with a block, calls `capture` which escapes the string result of the block regardless of what is specified in the `escape` argument to `content_tag`, `content_tag_string` eventually checks the argument, but it appears to be too late by then.\r\n\r\nhttps://github.com/rails/rails/blob/master/actionview/lib/action_view/helpers/tag_helper.rb  \r\n`````\r\n      def content_tag(name, content_or_options_with_block = nil, options = nil, escape = true, &block)\r\n        if block_given?\r\n          options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)\r\n          content_tag_string(name, capture(&block), options, escape)\r\n        else\r\n          content_tag_string(name, content_or_options_with_block, options, escape)\r\n        end\r\n      end\r\n`````\r\n\r\nhttps://github.com/rails/rails/blob/master/actionview/lib/action_view/helpers/capture_helper.rb  \r\n`````\r\n     def capture(*args)\r\n        value = nil\r\n        buffer = with_output_buffer { value = yield(*args) }\r\n        if string = buffer.presence || value and string.is_a?(String)\r\n          ERB::Util.html_escape string\r\n        end\r\n      end\r\n`````"}}