mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Merge branch '108518226-Epp-IDNA-support' into staging
This commit is contained in:
commit
106d3b4109
3 changed files with 13 additions and 2 deletions
|
@ -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 << {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue