Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the existing validation flow for sieve filter #6205

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions data/web/inc/ajax/sieve_validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
if (!isset($_SESSION['mailcow_cc_role'])) {
exit();
}
if (isset($_GET['script'])) {
if (isset($_REQUEST['script'])) {
$sieve = new Sieve\SieveParser();
try {
if (empty($_GET['script'])) {
if (empty($_REQUEST['script'])) {
echo json_encode(array('type' => 'danger', 'msg' => $lang['danger']['script_empty']));
exit();
}
$sieve->parse($_GET['script']);
$sieve->parse($_REQUEST['script']);
}
catch (Exception $e) {
echo json_encode(array('type' => 'danger', 'msg' => $e->getMessage()));
Expand Down
3 changes: 1 addition & 2 deletions data/web/js/site/mailbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,8 @@ $(document).ready(function() {
// Get script_data textarea content from form the button was clicked in
var script = $('textarea[name="script_data"]', $(this).parents('form:first')).val();
$.ajax({
dataType: 'json',
url: "/inc/ajax/sieve_validation.php",
type: "get",
type: "post",
data: { script: script },
complete: function(data) {
var response = (data.responseText);
Expand Down
Loading