[Rt-commit] rt branch, 4.0/querybuilder-cf-name-quoting, created. rt-4.0.5-82-ga3b9b97

Alex Vandiver alexmv at bestpractical.com
Tue Mar 13 14:44:01 EDT 2012


The branch, 4.0/querybuilder-cf-name-quoting has been created
        at  a3b9b97e8a1050b4aca7fa1e75e5249f54fd2eb4 (commit)

- Log -----------------------------------------------------------------
commit a3b9b97e8a1050b4aca7fa1e75e5249f54fd2eb4
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Mar 13 14:39:17 2012 -0400

    Fix quoting of CF names which contained odder characters
    
    a90baf3, in addition to correctly escaping quotes when quoting key
    names, changed _which_ keys were escaped, from "all CFs" to "keys with
    ', \, or whitespace."  Since the parser (in RT::SQL) only recognizes
    keywords as /[{}\w\.]+/ or a quoted string, this meant that custom field
    names with dashes and the like were incorrectly not quoted.
    
    Restore the quoting on keys which contain characters outside [{}\w\.]

diff --git a/lib/RT/Interface/Web/QueryBuilder/Tree.pm b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
index e7f2d5a..2cfc889 100644
--- a/lib/RT/Interface/Web/QueryBuilder/Tree.pm
+++ b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
@@ -277,7 +277,7 @@ sub ParseSQL {
             $value = "'$value'";
         }
 
-        if ($key =~ s/(['\\])/\\$1/g or $key =~ /\s/) {
+        if ($key =~ s/(['\\])/\\$1/g or $key =~ /[^{}\w\.]/) {
             $key = "'$key'";
         }
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list