summaryrefslogtreecommitdiff
path: root/app/helpers/application_helper.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-04-23 12:08:03 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-04-23 12:08:03 +0300
commit71f6143552a47209d4d83c35260db608cac7de1a (patch)
treeb5c16ae980c71adc7af6ef803369d2f0f33d4bb3 /app/helpers/application_helper.rb
parent63c5911961909b12b328b4182ba0f4b0e13c1bd6 (diff)
parentaac27550457eaf0503ce9bf7b04c18141ed317af (diff)
downloadgitlab-ce-71f6143552a47209d4d83c35260db608cac7de1a.tar.gz
Merge branch 'master' into new-sidebar
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Conflicts: app/controllers/snippets_controller.rb
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 5c77af729d0..a6844b2a47b 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -255,11 +255,15 @@ module ApplicationHelper
#
# Returns `html_options`, adding `rel: nofollow` for external links
def add_nofollow(link, html_options = {})
- uri = URI(link)
+ begin
+ uri = URI(link)
- if uri && uri.absolute? && uri.host != Gitlab.config.gitlab.host
- rel = html_options.fetch(:rel, '')
- html_options[:rel] = (rel + ' nofollow').strip
+ if uri && uri.absolute? && uri.host != Gitlab.config.gitlab.host
+ rel = html_options.fetch(:rel, '')
+ html_options[:rel] = (rel + ' nofollow').strip
+ end
+ rescue URI::Error
+ # noop
end
html_options