Bug #17951
closed
Installation fails/breaks when there is a double dash (--) in the domainname of a machine.
Added by Jan Vansteenkiste almost 8 years ago.
Updated over 3 years ago.
Description
The rake tasks (db:seed) throws a terrible stacktrace with a validation error. After a lot of debugging I narrowed it down to:
Given domainname: foo--bar.example.com
In app/models/setting/general.rb#L8
administrator = "root@#{domain}"
Which is validated by app/validators/email_validator.rb and fails.
Possible solutions are backporting the changes to the email_validator (using the mail gem) or adjusting the beast of a regex to match domain names with double dashes in the name.
diff --git a/test/unit/validators/email_validator_test.rb b/test/unit/validators/email_validator_test.rb
index 34c167b9b..4639217fc 100644
--- a/test/unit/validators/email_validator_test.rb
+++ b/test/unit/validators/email_validator_test.rb
@@ -30,4 +30,9 @@ class EmailValidatorTest < ActiveSupport::TestCase
test 'should allow blank' do
assert @validatable.valid?
end
+
+ test 'should allow double dashes in domain' do
+ @validatable.mail = 'admin@foobar--example.com'
+ assert @validatable.valid?
+ end
end
- Category set to Settings
- Priority changed from Urgent to Normal
Possible solutions are backporting the changes to the email_validator (using the mail gem)
To be clear, this is treated as valid by email_validator in 1.14.0-RC1 and above.
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/4158 added
- Status changed from Ready For Testing to Closed
Following the PR, closing this ticket as well
Also available in: Atom
PDF