Project

General

Profile

« Previous | Next » 

Revision a525db23

Added by Stephen Benjamin almost 6 years ago

fixes #23232 - fix error when domain not in taxonomy

This ensures that if domain_id is set, but domain not found (for example
when domain is in another taxonomy), the shortname still removes the
domain from the host's FQDN.

View differences:

app/models/nic/base.rb
end
def shortname
domain.nil? ? name : name.to_s.chomp("." + domain.name)
if domain
name.to_s.chomp("." + domain.name)
elsif domain_id && (unscoped_domain = Domain.unscoped.find_by(id: domain_id))
# If domain is nil, but domain_id is set, domain could be
# in another taxonomy. Don't fail to create a correct shortname.
name.to_s.chomp("." + unscoped_domain.name)
else
name
end
end
def validated?

Also available in: Unified diff