Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing url_rewriter when there is no host available (example: includi…

…ng url_helpers in a model where a @request object is not available)
  • Loading branch information...
commit a6e9cac8eb6106e6b33857a5c4ffd6a0f0c6fa79 1 parent a0ed776
@joslynesser joslynesser authored
Showing with 2 additions and 1 deletion.
  1. +1 −1  lib/subdomain_fu/subdomain_fu.rb
  2. +1 −0  spec/subdomain_fu_spec.rb
View
2  lib/subdomain_fu/subdomain_fu.rb
@@ -131,7 +131,7 @@ def self.override_only_path?
end
def self.needs_rewrite?(subdomain, host)
- return false if host.count('.') < config.tld_size
+ return false unless host && host.count('.') >= config.tld_size
case subdomain
when nil
#rewrite when there is a preferred mirror set and there is no subdomain on the host
View
1  spec/subdomain_fu_spec.rb
@@ -258,6 +258,7 @@
it { SubdomainFu.needs_rewrite?(false,"awesome.localhost").should be_true }
it { SubdomainFu.needs_rewrite?(false,"www.localhost").should be_false }
it { SubdomainFu.needs_rewrite?("www","awesome.localhost").should be_true }
+ it { SubdomainFu.needs_rewrite?(nil, nil).should be_false }
describe "when preferred_mirror is false" do
before do
Please sign in to comment.
Something went wrong with that request. Please try again.