Fix error when looking handle with surrounding spaces (#18225)

lolsob-rspec
Claire 2022-05-02 01:00:08 +02:00 committed by GitHub
parent 089e1e5554
commit 3c87683cf2
2 changed files with 3 additions and 1 deletions

View File

@ -12,5 +12,7 @@ class Api::V1::Accounts::LookupController < Api::BaseController
def set_account def set_account
@account = ResolveAccountService.new.call(params[:acct], skip_webfinger: true) || raise(ActiveRecord::RecordNotFound) @account = ResolveAccountService.new.call(params[:acct], skip_webfinger: true) || raise(ActiveRecord::RecordNotFound)
rescue Addressable::URI::InvalidURIError
raise(ActiveRecord::RecordNotFound)
end end
end end

View File

@ -66,7 +66,7 @@ class ResolveAccountService < BaseService
@username = @account.username @username = @account.username
@domain = @account.domain @domain = @account.domain
else else
@username, @domain = uri.split('@') @username, @domain = uri.strip.gsub(/\A@/, '').split('@')
end end
@domain = begin @domain = begin