fix: Fix to an issue with server urls having a trailing slash causing an invalid sharing group server detection

pull/1128/head
Iglocska 2016-05-12 15:22:53 +02:00
parent bff7e7f0a3
commit 7ec1d1461e
3 changed files with 10 additions and 2 deletions

View File

@ -1 +1 @@
{"major":2, "minor":4, "hotfix":43}
{"major":2, "minor":4, "hotfix":44}

View File

@ -49,7 +49,7 @@ class AppModel extends Model {
// major -> minor -> hotfix -> requires_logout
public $db_changes = array(
2 => array(
4 => array(18 => false, 19 => false, 20 => false, 25 => false, 27 => false, 32 => false, 33 => true, 38 => true, 39 => true, 40 => false, 42 => false)
4 => array(18 => false, 19 => false, 20 => false, 25 => false, 27 => false, 32 => false, 33 => true, 38 => true, 39 => true, 40 => false, 42 => false, 44 => false)
)
);
@ -366,6 +366,9 @@ class AppModel extends Model {
case '2.4.42':
$sqlArray[] = "ALTER TABLE `attributes` ADD `deleted` tinyint(1) NOT NULL DEFAULT '0';";
break;
case '2.4.44':
$sqlArray[] = "UPDATE `servers` SET `url` = TRIM(TRAILING '/' FROM `url`)";
break;
case 'fixNonEmptySharingGroupID':
$sqlArray[] = 'UPDATE `events` SET `sharing_group_id` = 0 WHERE `distribution` != 4';
$sqlArray[] = 'UPDATE `attributes` SET `sharing_group_id` = 0 WHERE `distribution` != 4';

View File

@ -1103,6 +1103,11 @@ class Server extends AppModel {
return $this->field('id', array('id' => $serverid, 'org' => $org)) === $serverid;
}
public function beforeSave($options = array()) {
$this->data['Server']['url'] = rtrim($this->data['Server']['url'], '/');
return true;
}
public function pull($user, $id = null, $technique=false, $server, $jobId = false, $percent = 100, $current = 0) {
if ($jobId) {
$job = ClassRegistry::init('Job');