issues_controller_backslash_escape_fix.diff

Go MAEDA, 2010-03-19 17:36

Download (760 Bytes)

View differences:

app/controllers/issues_controller.rb (working copy)
224 224
      text = @issue.description
225 225
    end
226 226
    content = "#{ll(Setting.default_language, :text_user_wrote, user)}\\n> "
227
    content << text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
227
    content << text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub('\\', '\\\\\\\\').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
228 228
    render(:update) { |page|
229 229
      page.<< "$('notes').value = \"#{content}\";"
230 230
      page.show 'update'