Browse Source

Improved fqdn detection with :port urls.

Martin Edenhofer 8 years ago
parent
commit
f529def251

+ 1 - 1
app/controllers/getting_started_controller.rb

@@ -147,7 +147,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
     # split url in http_type and fqdn
     settings = {}
     if !Setting.get('system_online_service')
-      if params[:url] =~ %r{/^(http|https)://(.+?)$}
+      if params[:url] =~ %r{/^(http|https)://(.+?)(:.+?|/.+?|)$}
         Setting.set('http_type', $1)
         settings[:http_type] = $1
         Setting.set('fqdn', $2)

+ 31 - 1
test/browser/aaa_getting_started_test.rb

@@ -165,7 +165,37 @@ class AaaGettingStartedTest < TestCase
     )
     location_check(
       url: '#clues',
-    #url: '#dashboard',
+      #url: '#dashboard',
+    )
+
+    clues_close(
+      optional: false,
+    )
+
+    # verify organization and fqdn
+    click(
+      css: 'a[href="#manage"]',
+    )
+    click(
+      css: 'a[href="#settings/branding"]',
+    )
+
+    match(
+      css: '#content input[name="organization"]',
+      value: 'Some Organization',
+    )
+    click(
+      css: 'a[href="#settings/system"]',
+    )
+
+    fqdn = nil
+    if browser_url =~ %r{://(.+?)(:.+?|/.+?|)$}
+      fqdn = $1
+    end
+    raise "Unable to get fqdn based on #{browser_url}" if !fqdn
+    match(
+      css: '#content input[name="fqdn"]',
+      value: fqdn,
     )
   end