[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.8-173-g6c44641
Ruslan Zakirov
ruz at bestpractical.com
Tue Oct 19 08:00:36 EDT 2010
The branch, 3.8-trunk has been updated
via 6c44641cd50c4f3ad631f4cb22292bb37a3c6c97 (commit)
from 90e89d2463651c3198981c0e32d2ec0ea1c480dc (commit)
Summary of changes:
lib/RT/SQL.pm | 2 +-
t/web/query_builder.t | 13 +++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit 6c44641cd50c4f3ad631f4cb22292bb37a3c6c97
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Tue Oct 19 15:59:14 2010 +0400
don't corupt queries with negative not-quoted numbers
like 'Priority > -2'.
diff --git a/lib/RT/SQL.pm b/lib/RT/SQL.pm
index 799cf94..946a8ab 100644
--- a/lib/RT/SQL.pm
+++ b/lib/RT/SQL.pm
@@ -68,7 +68,7 @@ my @tokens = qw[VALUE AGGREGATOR OPERATOR OPEN_PAREN CLOSE_PAREN KEYWORD];
use Regexp::Common qw /delimited/;
my $re_aggreg = qr[(?i:AND|OR)];
my $re_delim = qr[$RE{delimited}{-delim=>qq{\'\"}}];
-my $re_value = qr[\d+|NULL|$re_delim];
+my $re_value = qr[[+-]?\d+|NULL|$re_delim];
my $re_keyword = qr[[{}\w\.]+|$re_delim];
my $re_op = qr[=|!=|>=|<=|>|<|(?i:IS NOT)|(?i:IS)|(?i:NOT LIKE)|(?i:LIKE)]; # long to short
my $re_open_paren = qr[\(];
diff --git a/t/web/query_builder.t b/t/web/query_builder.t
index 02ed129..fa2c56d 100644
--- a/t/web/query_builder.t
+++ b/t/web/query_builder.t
@@ -5,7 +5,7 @@ use HTTP::Request::Common;
use HTTP::Cookies;
use LWP;
use Encode;
-use RT::Test tests => 42;
+use RT::Test tests => 44;
my $cookie_jar = HTTP::Cookies->new;
my ($baseurl, $agent) = RT::Test->started_ok;
@@ -246,4 +246,13 @@ diag "input a condition, select (several conditions), click delete"
);
}
-1;
+diag "send query with not quoted negative number";
+{
+ my $response = $agent->get($url."Search/Build.html?Query=Priority%20>%20-2");
+ ok( $response->is_success, "Fetched " . $url."Search/Build.html" );
+
+ is( getQueryFromForm,
+ "Priority > -2",
+ "query is the same"
+ );
+}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list