diff options
author | Jenkins <jenkins@jenkins.ninjawedding.org> | 2018-06-12 13:17:21 +0000 |
---|---|---|
committer | Jenkins <jenkins@jenkins.ninjawedding.org> | 2018-06-12 13:17:21 +0000 |
commit | 4d8d1fa129b5f8692311de211203bc18c614951f (patch) | |
tree | e9a1130c9a9e5a5b8babd2ba3153e4ed03a4581e /app/controllers/intents_controller.rb | |
parent | 34f1fd2a621ca869c17009487e2f10063812fbd0 (diff) | |
parent | 6151308c47efb0e05bcb2c54aa1693f5ff04da5c (diff) |
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
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 |