]> cat aescling's git repositories - mastodon.git/commitdiff
Fix error when looking handle with surrounding spaces (#18225)
authorClaire <claire.github-309c@sitedethib.com>
Sun, 1 May 2022 23:00:08 +0000 (01:00 +0200)
committersingle-right-quote <11325618-aescling@users.noreply.gitlab.com>
Thu, 5 May 2022 17:49:13 +0000 (13:49 -0400)
app/controllers/api/v1/accounts/lookup_controller.rb
app/services/resolve_account_service.rb

index aee6be18a9e344b3b3a0a39aa5ae11095ee1cf95..8597f891d6d04c20748c8552d5e7ca1ad5d27201 100644 (file)
@@ -12,5 +12,7 @@ class Api::V1::Accounts::LookupController < Api::BaseController
 
   def set_account
     @account = ResolveAccountService.new.call(params[:acct], skip_webfinger: true) || raise(ActiveRecord::RecordNotFound)
+  rescue Addressable::URI::InvalidURIError
+    raise(ActiveRecord::RecordNotFound)
   end
 end
index 21332a03eb335032c0e90979bd522e86a087e2c6..387e2e09b45512d4a6446ffef965f0ed6d63d3a3 100644 (file)
@@ -66,7 +66,7 @@ class ResolveAccountService < BaseService
       @username = @account.username
       @domain   = @account.domain
     else
-      @username, @domain = uri.split('@')
+      @username, @domain = uri.strip.gsub(/\A@/, '').split('@')
     end
 
     @domain = begin