Throw error when using deleteheader with :last but no :index

pull/192/merge
Aleksander Machniak 6 years ago
parent 471234b4a1
commit 8f1405d569

@ -1124,7 +1124,12 @@ class rcube_sieve_engine
$this->form['actions'][$i]['comparator'] = $delheader_comp[$idx];
$this->form['actions'][$i]['index'] = $delheader_index[$idx];
if (!empty($this->form['actions'][$i]['index']) && !preg_match('/^[0-9]+$/i', $this->form['actions'][$i]['index'])) {
if (empty($this->form['actions'][$i]['index'])) {
if (!empty($this->form['actions'][$i]['last'])) {
$this->errors['actions'][$i]['index'] = $this->plugin->gettext('lastindexempty');
}
}
else if (!preg_match('/^[0-9]+$/i', $this->form['actions'][$i]['index'])) {
$this->errors['actions'][$i]['index'] = $this->plugin->gettext('forbiddenchars');
}
}

@ -276,5 +276,6 @@ $messages['forwardsaved'] = 'Forward data saved successfully.';
$messages['emptyvacationbody'] = 'Body of vacation message is required!';
$messages['duplicate.conflict.err'] = 'Both header and unique identifier are not allowed.';
$messages['disabledaction'] = 'Action not permitted.';
$messages['lastindexempty'] = 'Index is required when counting from end';
?>

Loading…
Cancel
Save