Defect #9673

Angle brackets within 'pre' blocks are silently replaced by named HTML entities during wiki section-edit

Added by Mischa The Evil about 6 years ago. Updated about 6 years ago.

Status:ClosedStart date:2011-11-28
Priority:UrgentDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Wiki
Target version:-
Resolution:Fixed Affected version:

Description

I noticed this issue while working offline (read on my own test-box; also to test new features recently added to the core) on improvements for RedmineReceivingEmails.

What I did:

1. Copied the complete content of RedmineReceivingEmails to a wikipage in a project in my local Redmine instance (source:/trunk@7962)
2. Section-edited "Enabling anonymous users to create issues by email"-section and saved the page

Now, looking at the diff of the new page-version (and of course the actual page content), the angle brackets within the < pre > blocks in the "Reading emails from standard input" and "Forwarding emails from your email server" sections are silently replaced by their named HTML entities substitutions (&lt; & &gt;).

After I found out the above I tried the same with a fresh (again local) copy of RedmineReceivingEmails but instead of section-editing I choose to regularly edit the whole wiki-page and still only make changes in the "Enabling anonymous users to create issues by email"-section.
This resulted in the correct behavior and made it sure to me that this issue is related to / happens only while using the recently introduced wiki section-editing feature.

I took it even one more step further by doing another section-edit (now on "How it works") and this resulted in the same incorrect behavior. That is, it now replaces the earlier inserted ampersands to his named HTML entitity substitution (&amp;). In that way it's consistent.

Although this happens on my local instance of Redmine I'm pretty sure it will happen on (currently updated) redmine.org too whenever I make these section-edits "in production".

Environment:
  • Redmine: source:/trunk@7962
  • Ruby: 1.8.7 [x86_64-linux] (REE 1.8.7-2011.03)
  • RubyGems: 1.3.7
  • Rack: 1.1.2
  • Rails: 2.3.14
  • MySQL: 5.1.41
  • Browser: Mozilla Firefox 7.0.1

Please let me know if more information is required.


Related issues

Related to Redmine - Feature #2222: Single section edit. Closed 2008-11-21

Associated revisions

Revision 7969
Added by Jean-Philippe Lang about 6 years ago

Fixed: Angle brackets within 'pre' blocks are silently replaced by HTML entities during wiki section-edit (#9673).

Revision 7975
Added by Jean-Philippe Lang about 6 years ago

Fixed: Wiki section edit escapes code tags inside pre blocks (#9673).

Revision 7976
Added by Jean-Philippe Lang about 6 years ago

Fixed: Wiki section edit escapes pre tags inside pre blocks (#9673).

History

#1 Updated by Mischa The Evil about 6 years ago

Can this be related to issue #9440?

#2 Updated by Etienne Massip about 6 years ago

  • Priority changed from High to Urgent

#3 Updated by Jean-Philippe Lang about 6 years ago

  • Status changed from New to Resolved

This should be fixed in r7969.

#4 Updated by Etienne Massip about 6 years ago

I also noticed that trailing whitespaces are chopped, so you won't be able to insert as much space as you want to have at the end of the section and before the following section title.

Needs to be confirmed, though.

#5 Updated by Mischa The Evil about 6 years ago

Jean-Philippe Lang wrote:

This should be fixed in r7969.

Confirmed. For the record, the introduced test (test_update_section_should_not_escape_pre_content_outside_section, source:/trunk/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb@7969#L305) is scoped to test for escape issue in pre content outside section.
From what I can tell this commit also fixes this behavior for sections which are currently section-edited (thus inside section). Don't know though if it's a matter that should be changed.

#6 Updated by Jean-Philippe Lang about 6 years ago

Etienne Massip wrote:

I also noticed that trailing whitespaces are chopped, so you won't be able to insert as much space as you want to have at the end of the section and before the following section title.

Indeed, additional white space are stripped when editing a section but I don't think it's a serious issue since multiple blank lines won't make any difference in the formatted text.

Mischa The Evil wrote:

Confirmed. For the record, the introduced test (test_update_section_should_not_escape_pre_content_outside_section, source:/trunk/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb@7969#L305) is scoped to test for escape issue in pre content outside section.

The test matches what you described in this ticket description (angle brackets escaped in the "Reading emails from standard input" when editing "Enabling anonymous users to create issues by email" which is an other section).

BTW, another fix was required for code tags inside pre blocks (see r7975).

#7 Updated by Jean-Philippe Lang about 6 years ago

And another fix in r7976.

#8 Updated by Jean-Philippe Lang about 6 years ago

  • Status changed from Resolved to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

#9 Updated by Mischa The Evil about 6 years ago

Mischa The Evil wrote:

Can this be related to issue #9440?

It wasn't.

Also available in: Atom PDF