summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--app/Model/Config.php5
-rw-r--r--tests/units/Model/ConfigTest.php21
3 files changed, 20 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d43311c..9675a8e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,7 @@ Core functionalities moved to plugins:
Improvements:
+* Make sure there is always a trailing slash for application_url
* Do not show the checkbox "Show default swimlane" when there is no active swimlanes
* Append filters instead of replacing value for users and categories dropdowns
* Do not show empty swimlanes in public view
diff --git a/app/Model/Config.php b/app/Model/Config.php
index 8e51da24..bbc86a88 100644
--- a/app/Model/Config.php
+++ b/app/Model/Config.php
@@ -208,6 +208,11 @@ class Config extends Base
{
foreach ($values as $option => $value) {
+ // Be sure that a trailing slash is there for the url
+ if ($option === 'application_url' && ! empty($value) && substr($value, -1) !== '/') {
+ $value .= '/';
+ }
+
$result = $this->db->table(self::TABLE)->eq('option', $option)->update(array('value' => $value));
if (! $result) {
diff --git a/tests/units/Model/ConfigTest.php b/tests/units/Model/ConfigTest.php
index c0ed0313..832575b8 100644
--- a/tests/units/Model/ConfigTest.php
+++ b/tests/units/Model/ConfigTest.php
@@ -7,6 +7,20 @@ use Core\Session;
class ConfigTest extends Base
{
+ public function testSaveApplicationUrl()
+ {
+ $c = new Config($this->container);
+
+ $this->assertTrue($c->save(array('application_url' => 'http://localhost/')));
+ $this->assertEquals('http://localhost/', $c->get('application_url'));
+
+ $this->assertTrue($c->save(array('application_url' => 'http://localhost')));
+ $this->assertEquals('http://localhost/', $c->get('application_url'));
+
+ $this->assertTrue($c->save(array('application_url' => '')));
+ $this->assertEquals('', $c->get('application_url'));
+ }
+
public function testDefaultValues()
{
$c = new Config($this->container);
@@ -56,11 +70,4 @@ class ConfigTest extends Base
session_id('');
unset($this->container['session']);
}
-
- public function testSave()
- {
- $c = new Config($this->container);
- $this->assertTrue($c->save(array('application_url' => 'http://localhost/')));
- $this->assertEquals('http://localhost/', $c->get('application_url'));
- }
}