Module: Redmine::Helpers::URL
- Included in:
- ApplicationHelper, RedCloth3, FieldFormat::Base, WikiFormatting::Markdown::HTML
- Defined in:
- lib/redmine/helpers/url.rb
Overview
Instance Method Summary collapse
Instance Method Details
#uri_with_safe_scheme?(uri, schemes = ['http', 'https', 'ftp', 'mailto', nil]) ⇒ Boolean
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/redmine/helpers/url.rb', line 23 def uri_with_safe_scheme?(uri, schemes = ['http', 'https', 'ftp', 'mailto', nil]) # URLs relative to the current document or document root (without a protocol # separator, should be harmless return true unless uri.to_s.include? ":" # Other URLs need to be parsed schemes.include? URI.parse(uri).scheme rescue URI::Error false end |