Merge branch '108518226-Epp-IDNA-support' into staging

This commit is contained in:
Matt Farnsworth 2015-11-19 19:12:24 +02:00
commit 106d3b4109
3 changed files with 13 additions and 2 deletions

View file

@ -229,7 +229,7 @@ class Epp::DomainsController < EppController
def find_domain def find_domain
domain_name = params[:parsed_frame].css('name').text.strip.downcase domain_name = params[:parsed_frame].css('name').text.strip.downcase
@domain = Epp::Domain.where(name: domain_name).includes(registrant: :registrar).first @domain = Epp::Domain.find_by_idn domain_name
unless @domain unless @domain
epp_errors << { epp_errors << {

View file

@ -334,6 +334,17 @@ class Domain < ActiveRecord::Base
self[:name_dirty] = value self[:name_dirty] = value
end end
# find by internationalized domain name
# internet domain name => ascii or puny, but db::domains.name is unicode
def self.find_by_idn(name)
domain = self.find_by_name name
if domain.blank? && name.include?('-')
unicode = SimpleIDN.to_unicode name # we have no index on domains.name_puny
domain = self.find_by_name unicode
end
domain
end
def roid def roid
"EIS-#{id}" "EIS-#{id}"
end end

View file

@ -838,7 +838,7 @@ class Epp::Domain < Domain
next next
end end
if Domain.find_by(name: x) if Domain.find_by_idn x
res << { name: x, avail: 0, reason: 'in use' } res << { name: x, avail: 0, reason: 'in use' }
else else
res << { name: x, avail: 1 } res << { name: x, avail: 1 }