[Rt-commit] rt branch, 4.0/escape-quotes-in-search-format, created. rt-4.0.17-90-g5782144
? sunnavy
sunnavy at bestpractical.com
Tue Oct 1 11:52:24 EDT 2013
The branch, 4.0/escape-quotes-in-search-format has been created
at 5782144c9557561ec66fa1146f00e3f0fb8242de (commit)
- Log -----------------------------------------------------------------
commit 5782144c9557561ec66fa1146f00e3f0fb8242de
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Oct 1 23:39:56 2013 +0800
escape quotes for custom field in search results
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/Header b/share/html/Elements/CollectionAsTable/Header
index ffb7441..ae2cab0 100644
--- a/share/html/Elements/CollectionAsTable/Header
+++ b/share/html/Elements/CollectionAsTable/Header
@@ -112,6 +112,7 @@ foreach my $col ( @Format ) {
} else {
$title = $m->comp('/Elements/ScrubHTML', Content => $title);
}
+ $title =~ s!\\(.)!$1!g;
if ( $AllowSorting and $col->{'attribute'}
and my $attr = $m->comp(
diff --git a/share/html/Elements/ColumnMap b/share/html/Elements/ColumnMap
index 4b3a8e1..bbb7a66 100644
--- a/share/html/Elements/ColumnMap
+++ b/share/html/Elements/ColumnMap
@@ -98,14 +98,16 @@ my $COLUMN_MAP = {
value => sub {
# Cache the CF object on a per-request basis, to avoid
# having to load it for every row
+ my $name = $_[-1];
+ $name =~ s!\\(.)!$1!g;
my $key = join("-","CF",
$_[0]->CustomFieldLookupType,
$_[0]->CustomFieldLookupId,
- $_[-1]);
+ $name);
my $cf = $m->notes($key);
unless ($cf) {
- $cf = $_[0]->LoadCustomFieldByIdentifier($_[-1]);
+ $cf = $_[0]->LoadCustomFieldByIdentifier($name);
$m->notes($key, $cf);
}
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