Patch #27114

Make robust Redmine::Helpers::URL#uri_with_safe_scheme?

Added by okkez _ almost 5 years ago. Updated almost 5 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:


Category:Text formatting
Target version:4.0.0


I'm developing new formatter for CommonMark.

commonmarker gem will create wrong autolink like .

n@.  b

will convert to

<p><a href="mailto:n@">n@</a>. b</p>

This causes `URI::InvalidComponentError`.

And I test with Redmine 3.4.2's Markdown formatter with following text.


This also causes `URI::InvalidComponentError`.

I wrote some patches to avoid these errors.

make-robust.diff Magnifier (1.2 KB) okkez _, 2017-10-03 03:02

Associated revisions

Revision 17035
Added by Go MAEDA almost 5 years ago

Make robust Redmine::Helpers::URL#uri_with_safe_scheme? (#27114)

Patch by okkez.

Revision 17064
Added by Toshi MARUYAMA almost 5 years ago

svn propset svn:eol-style native test/unit/lib/redmine/helpers/url_test.rb (#27114)


#1 Updated by Go MAEDA almost 5 years ago

  • Category changed from Wiki to Text formatting
  • Target version set to 4.0.0

I observed the following error when the exception class at source:tags/3.4.2/lib/redmine/helpers/url.rb#L30 is URI::InvalidURIError.
Setting target version to 4.0.0.

$ ruby test/unit/lib/redmine/helpers/url_test.rb
Run options: --seed 58810

# Running:


URI::InvalidComponentError: unrecognised opaque part for mailtoURL: root@
    lib/redmine/helpers/url.rb:29:in `uri_with_safe_scheme?'
    test/unit/lib/redmine/helpers/url_test.rb:15:in `test_uri_with_safe_scheme_invalid_component'

#2 Updated by Go MAEDA almost 5 years ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed in the trunk. Thank you for your contribution.

Also available in: Atom PDF