Skip to content

Commit e3929f1

Browse files
committed
Fixed: FS#998 - Mail filters: Foldernames may not start with a dot
1 parent b6ff2e1 commit e3929f1

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

interface/web/mail/form/mail_user_filter.tform.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@
109109
'target' => array (
110110
'datatype' => 'VARCHAR',
111111
'formtype' => 'TEXT',
112+
'validators' => array ( 0 => array ( 'type' => 'REGEX',
113+
'regex' => '/^[a-zA-Z0-9\.\-\_]{0,100}$/',
114+
'errmsg'=> 'target_error_regex'),
115+
),
112116
'default' => '',
113117
'value' => '',
114118
'width' => '30',

interface/web/mail/lib/lang/en_mail_user_filter.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ $wb["active_txt"] = 'Active';
66
$wb["rulename_error_empty"] = 'Name is empty.';
77
$wb["searchterm_is_empty"] = 'Search term is empty.';
88
$wb["source_txt"] = 'Source';
9+
$wb["target_error_regex"] = 'The target may only contain these characters: a-z, 0-9, -, . and _';
910
?>

interface/web/mail/mail_user_filter_edit.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ function onSubmit() {
6262
// Set the mailuser_id
6363
$this->dataRecord["mailuser_id"] = $mailuser["mailuser_id"];
6464

65+
// Remove leading dots
66+
if(substr($this->dataRecord['target'],0,1) == '.') $this->dataRecord['target'] = substr($this->dataRecord['target'],1);
67+
6568
parent::onSubmit();
6669
}
6770

0 commit comments

Comments
 (0)