##// END OF EJS Templates
Fixes backslashes escaping when quoting issue description/note (#5129)....
Jean-Philippe Lang -
r3502:b93cf03483d0
parent child
Show More
@@ -229,10 +229,13 class IssuesController < ApplicationController
229 user = @issue.author
229 user = @issue.author
230 text = @issue.description
230 text = @issue.description
231 end
231 end
232 content = "#{ll(Setting.default_language, :text_user_wrote, user)}\\n> "
232 # Replaces pre blocks with [...]
233 content << text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
233 text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
234 content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
235 content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
236
234 render(:update) { |page|
237 render(:update) { |page|
235 page.<< "$('notes').value = \"#{content}\";"
238 page.<< "$('notes').value = \"#{escape_javascript content}\";"
236 page.show 'update'
239 page.show 'update'
237 page << "Form.Element.focus('notes');"
240 page << "Form.Element.focus('notes');"
238 page << "Element.scrollTo('update');"
241 page << "Element.scrollTo('update');"
General Comments 0
You need to be logged in to leave comments. Login now