diff options
author | David Yip <yipdw@member.fsf.org> | 2018-06-12 18:13:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-12 18:13:30 -0500 |
commit | 5cff053944b4327477ca45882c9dd3b1a7a559e8 (patch) | |
tree | 83c564879534ea35f468ce319342e011773f24aa /app/controllers/intents_controller.rb | |
parent | 99b2bc2668e79bacd7f8696315206872086ebf3a (diff) | |
parent | f6bb50b6ece555af138df164680189b1ec57da4b (diff) |
Merge branch 'master' into 454-allow-keyword-mutes-to-skip-mentions
Diffstat (limited to 'app/controllers/intents_controller.rb')
-rw-r--r-- | app/controllers/intents_controller.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/app/controllers/intents_controller.rb b/app/controllers/intents_controller.rb index 504befd1f..56129d69a 100644 --- a/app/controllers/intents_controller.rb +++ b/app/controllers/intents_controller.rb @@ -1,9 +1,10 @@ # frozen_string_literal: true class IntentsController < ApplicationController - def show - uri = Addressable::URI.parse(params[:uri]) + before_action :check_uri + rescue_from Addressable::URI::InvalidURIError, with: :handle_invalid_uri + def show if uri.scheme == 'web+mastodon' case uri.host when 'follow' @@ -15,4 +16,18 @@ class IntentsController < ApplicationController not_found end + + private + + def check_uri + not_found if uri.blank? + end + + def handle_invalid_uri + not_found + end + + def uri + @uri ||= Addressable::URI.parse(params[:uri]) + end end |