Defect #5652

Bad URL parsing in the wiki when it ends with right-angle-bracket(greater-than mark).

Added by Minjie Zhu over 7 years ago. Updated about 7 years ago.

Status:ClosedStart date:2010-06-08
Priority:NormalDue date:
Assignee:Jean-Baptiste Barth% Done:

100%

Category:Wiki
Target version:1.0.3
Resolution:Fixed Affected version:1.0.2

Description

When I write an URL and angle-bracket around the URL like below, the parsing is not correct. The bracket should not be included in the URL.

<http://www.redmine.org/>

Refers to the RFC2396,

The angle-bracket "<" and ">" and double-quote (") characters are
excluded because they are often used as the delimiters around URI in
text documents and protocol fields.

Associated revisions

Revision 4287
Added by Jean-Baptiste Barth about 7 years ago

Fixed: auto links ending with right angle bracket shouldn't include the bracket in the URL. #5652

History

#1 Updated by Jean-Baptiste Barth over 7 years ago

  • Assignee set to Jean-Baptiste Barth

Thanks for reporting, I 100% agree..

When trying to look at this, I ran into the following problem : Redmine::WikiFormatting::Textile::Formatter#inline_auto_link method runs after textile parsing, so it receives something like http://www.redmine.org/> which is completely valid regarding the RFC.

If we don't want to do hacky things (and introduce a risk to not parse some valid urls correctly), we shoud change the way auto links are parsed : it should happen before textile, and they should be turned into standard textile links. But it can break so many things it should be heavily tested.

I'll try to investigate this tomorrow.

#2 Updated by Jean-Baptiste Barth over 7 years ago

Oops, my previous message was not so clear : "it receives something like http://www.redmine.org/&gt;

And it may not be valid regarding the RFC, but it at least only contains valid characters so it's difficult to parse it. We could find more problematic examples, like http://www.example.net/?page=blah>, which would be textilized to http://www.example.net/?page=blah&gt;, then parse with redmine auto links...

#3 Updated by Minjie Zhu over 7 years ago

Hi, Jean-Baptiste.

In our case, we often angle-bracket around a url if it is very long or contains some multi-byte chars. I think someone others may also have this issue.

Hope it will be fixed :)

Thanks for your investigation and I will also do some check for the redmine source, although I'm a beginner of rails :)

#4 Updated by Jean-Baptiste Barth about 7 years ago

  • Status changed from New to Resolved
  • Target version set to 1.0.3
  • % Done changed from 0 to 100
  • Affected version (unused) changed from devel to 1.0.2
  • Resolution set to Fixed
  • Affected version set to 1.0.2

I realized that &gt; shouldn't occur in the end of standard urls. Moreover wrapping links in angle brackets is a common practice, so we can introduce a specific case for that. Patch committed in r4287.

#5 Updated by Eric Davis about 7 years ago

  • Status changed from Resolved to Closed

Merged into 1.0-stable for release in 1.0.3

Also available in: Atom PDF