From f529def2517308a649a8c2c1c2e9df97abdde566 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 30 May 2016 09:09:07 +0200 Subject: [PATCH] Improved fqdn detection with :port urls. --- app/controllers/getting_started_controller.rb | 2 +- test/browser/aaa_getting_started_test.rb | 32 ++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/app/controllers/getting_started_controller.rb b/app/controllers/getting_started_controller.rb index 0d5c0f751..870711c89 100644 --- a/app/controllers/getting_started_controller.rb +++ b/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) diff --git a/test/browser/aaa_getting_started_test.rb b/test/browser/aaa_getting_started_test.rb index 78c928950..1621e7643 100644 --- a/test/browser/aaa_getting_started_test.rb +++ b/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