diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-03-27 13:33:19 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-03-27 13:33:19 +0000 |
commit | b93cf03483d09e6b4aa305f1c79015a2d9c875a9 (patch) | |
tree | 6cb2d515d21589ee1cc9edb9ea98391cdffe80d1 | |
parent | 883e7b1b9480a0822cf4c254224fb5a5c4fd184e (diff) | |
download | redmine-b93cf03483d09e6b4aa305f1c79015a2d9c875a9.tar.gz redmine-b93cf03483d09e6b4aa305f1c79015a2d9c875a9.zip |
Fixes backslashes escaping when quoting issue description/note (#5129).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3616 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/controllers/issues_controller.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index bbe71a3ea..10c8aebc1 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -229,10 +229,13 @@ class IssuesController < ApplicationController user = @issue.author text = @issue.description end - content = "#{ll(Setting.default_language, :text_user_wrote, user)}\\n> " - content << text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n" + # Replaces pre blocks with [...] + text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]') + content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> " + content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" + render(:update) { |page| - page.<< "$('notes').value = \"#{content}\";" + page.<< "$('notes').value = \"#{escape_javascript content}\";" page.show 'update' page << "Form.Element.focus('notes');" page << "Element.scrollTo('update');" |