diff --git a/app/models/user.rb b/app/models/user.rb index 605638f390a..db81134eeaa 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -252,7 +252,7 @@ class User < ActiveRecord::Base end scope :filter_by_username_or_email, ->(filter) do - if filter =~ /.+@.+/ + if filter.is_a?(String) && filter =~ /.+@.+/ # probably an email so try the bypass if user_id = UserEmail.where("lower(email) = ?", filter.downcase).pluck_first(:user_id) return where('users.id = ?', user_id) diff --git a/spec/lib/stylesheet/manager_spec.rb b/spec/lib/stylesheet/manager_spec.rb index 9b4179bac3d..0218e675441 100644 --- a/spec/lib/stylesheet/manager_spec.rb +++ b/spec/lib/stylesheet/manager_spec.rb @@ -929,7 +929,7 @@ RSpec.describe Stylesheet::Manager do after do path = Stylesheet::Manager.send(:manifest_full_path) - File.delete(path) if File.exists?(path) + File.delete(path) if File.exist?(path) end it "returns a hash" do