Project

General

Profile

Actions

Bug #17951

closed

Installation fails/breaks when there is a double dash (--) in the domainname of a machine.

Added by Jan Vansteenkiste over 7 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Settings
Target version:
-
Difficulty:
easy
Triaged:
No
Fixed in Releases:
Found in Releases:

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.

Actions #1

Updated by Jan Vansteenkiste over 7 years ago

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
Actions #2

Updated by Dominic Cleal over 7 years ago

  • 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.

Actions #3

Updated by The Foreman Bot over 7 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4158 added
Actions #4

Updated by Amir Fefer over 2 years ago

  • Status changed from Ready For Testing to Closed

Following the PR, closing this ticket as well

Actions

Also available in: Atom PDF