From 48c31ebdc65a881255e77f9d2594611ed2929006 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 2 Jan 2022 19:23:59 +0100 Subject: [PATCH] Apply review suggestion from @raccube Co-authored-by: Karina Kwiatek <6197148+raccube@users.noreply.github.com> --- app/services/shared_markers.rb | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/app/services/shared_markers.rb b/app/services/shared_markers.rb index cdc640fa..08d10276 100644 --- a/app/services/shared_markers.rb +++ b/app/services/shared_markers.rb @@ -2,16 +2,14 @@ module SharedMarkers include ActionView::Helpers::TagHelper def autolink(link, _link_type) - begin - href = if ALLOWED_HOSTS_IN_MARKDOWN.include?(URI(link).host) - link - else - linkfilter_path(url: link) - end - - content_tag(:a, link, href: href, target: "_blank", rel: "nofollow") - rescue - link - end + href = if ALLOWED_HOSTS_IN_MARKDOWN.include?(URI(link).host) + link + else + linkfilter_path(url: link) + end + + content_tag(:a, link, href: href, target: "_blank", rel: "nofollow") + rescue + link end end \ No newline at end of file