Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Story#109340154 - domain always uses unicode to make search #2

Merged
merged 1 commit into from
Dec 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ source 'https://rubygems.org'

# core
gem 'rails', '4.2.1'
gem 'simpleidn', '0.0.5' # For punycode

# model related
gem 'pg', '~> 0.18.0'
Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ GEM
ruby_parser (3.6.5)
sexp_processor (~> 4.1)
sexp_processor (4.5.0)
simpleidn (0.0.5)
slop (3.6.0)
spring (1.3.4)
sprockets (3.0.1)
Expand Down Expand Up @@ -167,5 +168,9 @@ DEPENDENCIES
rails (= 4.2.1)
recaptcha (~> 0.4.0)
rubocop (~> 0.26.1)
simpleidn (= 0.0.5)
spring (~> 1.3.3)
unicorn

BUNDLED WITH
1.10.6
8 changes: 5 additions & 3 deletions app/controllers/whois_records_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ class WhoisRecordsController < ApplicationController
def show
# fix id if there is no correct format
params[:id] = "#{params[:id]}.#{params[:format]}" if !['json', 'html'].include? params[:format]
@domain_name = SimpleIDN.to_unicode(params[:id].to_s)

@verified = verify_recaptcha
@whois_record = WhoisRecord.find_by(name: params[:id])
@whois_record = WhoisRecord.find_by(name: @domain_name)

begin
respond_to do |format|
Expand All @@ -13,7 +15,7 @@ def show
return render json: json
else
return render json: {
name: params[:id],
name: @domain_name,
error: "Domain not found."},
status: :not_found
end
Expand All @@ -22,7 +24,7 @@ def show
rescue ActionController::UnknownFormat
if @whois_record.present?
else
return render text: "Domain not found: #{CGI::escapeHTML params[:id]}", status: :not_found
return render text: "Domain not found: #{CGI::escapeHTML @domain_name}", status: :not_found
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
%meta{:content => "Full stack top-level domain (TLD) management.", :name => "description"}/
%meta{:content => "Gitlab LTD", :name => "author"}/
%title
Whois record: #{params[:id]}
Whois record: #{@domain_name}
%body
= render 'shared/flash'
= yield