[Rt-commit] rt branch, 4.0/escape-quotes-in-search-format, created. rt-4.0.18rc1-1-g420b0fe

? sunnavy sunnavy at bestpractical.com
Tue Oct 8 07:16:41 EDT 2013


The branch, 4.0/escape-quotes-in-search-format has been created
        at  420b0fe46bb5c61fb790f7dc31c6fd76e8c74a5e (commit)

- Log -----------------------------------------------------------------
commit 420b0fe46bb5c61fb790f7dc31c6fd76e8c74a5e
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Oct 1 23:39:56 2013 +0800

    handle quotes in search format
    
    previously we don't handle it at all, so the format is like
    '__CustomField.{foo's bar}__', which breaks the parse logic badly.
    
    with this fix, the format will be like '__CustomField.{foo\'s bar}__'

diff --git a/share/html/Elements/CollectionAsTable/ParseFormat b/share/html/Elements/CollectionAsTable/ParseFormat
index e003704..658a2da 100644
--- a/share/html/Elements/CollectionAsTable/ParseFormat
+++ b/share/html/Elements/CollectionAsTable/ParseFormat
@@ -59,6 +59,7 @@ while ($Format =~ /($RE{delimited}{-delim=>qq{\'"}}|[{}\w.]+)/go) {
     if ($col =~ /^$RE{quoted}$/o) {
         substr($col,0,1) = "";
         substr($col,-1,1) = "";
+        $col =~ s/\\(.)/$1/g;
     }
 
     my $colref = { };
diff --git a/share/html/Search/Elements/EditFormat b/share/html/Search/Elements/EditFormat
index c3491fc..e6a8c7f 100644
--- a/share/html/Search/Elements/EditFormat
+++ b/share/html/Search/Elements/EditFormat
@@ -59,7 +59,9 @@
 <td valign="top"><select size="6" name="SelectDisplayColumns" multiple="multiple">
 % my %seen;
 % foreach my $field ( grep !$seen{lc $_}++, @$AvailableColumns) {
-<option value="<% $field %>"><% loc($field) %></option>
+% my $value = $field;
+% $value =~ s!(['\\])!\\$1!g;
+<option value="<% $value %>"><% loc($field) %></option>
 % }
 </select></td>
 <td>
@@ -106,7 +108,9 @@
 <select size="4" name="CurrentDisplayColumns">
 % my $i=0;
 % foreach my $field ( @$CurrentFormat ) {
-<option value="<% $i++ %>><% $field->{Column} %>"><% loc( $field->{Column} ) %></option>
+% my $label = $field->{Column};
+% $label =~ s!\\(.)!$1!g;
+<option value="<% $i++ %>><% $field->{Column} %>"><% loc( $label ) %></option>
 % }
 </select>
 <br />

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


More information about the Rt-commit mailing list