[Rt-commit] r13059 - in rt/branches/3.8-TESTING: . lib/RT/Interface share/html/REST/1.0/search

sartak at bestpractical.com sartak at bestpractical.com
Mon Jun 9 13:33:53 EDT 2008


Author: sartak
Date: Mon Jun  9 13:33:52 2008
New Revision: 13059

Modified:
   rt/branches/3.8-TESTING/   (props changed)
   rt/branches/3.8-TESTING/lib/RT/Interface/REST.pm
   rt/branches/3.8-TESTING/share/html/REST/1.0/dhandler
   rt/branches/3.8-TESTING/share/html/REST/1.0/search/ticket

Log:
 r61875 at onn:  sartak | 2008-06-09 13:24:13 -0400
 Allow : ( ) / in custom-field names in REST, refactor that regex into RT::Interface::REST->field_spec. rt3.fsck.com #8512. Patch originally from Jeff at ITA.


Modified: rt/branches/3.8-TESTING/lib/RT/Interface/REST.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/Interface/REST.pm	(original)
+++ rt/branches/3.8-TESTING/lib/RT/Interface/REST.pm	Mon Jun  9 13:33:52 2008
@@ -63,7 +63,7 @@
     @EXPORT = qw(expand_list form_parse form_compose vpush vsplit);
 }
 
-my $field = '(?i:[a-z][a-z0-9_-]*|C(?:ustom)?F(?:ield)?-(?:[a-z0-9_ -]|\s)+)';
+sub field_spec { '(?i:[a-z][a-z0-9_-]*|C(?:ustom)?F(?:ield)?-(?:[a-z0-9_ :()/-]|\s)+)' }
 
 # WARN: this code is duplicated in bin/rt.in,
 # change both functions at once
@@ -96,6 +96,7 @@
     my @forms = ();
     my @lines = split /\n/, $_[0];
     my ($c, $o, $k, $e) = ("", [], {}, "");
+    my $field = __PACKAGE__->field_spec;
 
     LINE:
     while (@lines) {

Modified: rt/branches/3.8-TESTING/share/html/REST/1.0/dhandler
==============================================================================
--- rt/branches/3.8-TESTING/share/html/REST/1.0/dhandler	(original)
+++ rt/branches/3.8-TESTING/share/html/REST/1.0/dhandler	Mon Jun  9 13:33:52 2008
@@ -63,7 +63,7 @@
 my $name   = qr{[\w.-]+};
 my $list   = '(?:(?:\d+-)?\d+,)*(?:\d+-)?\d+';
 my $label  = '[a-zA-Z0-9 at _.+-]+';
-my $field  = '[a-zA-Z](?:[a-zA-Z0-9_-]|\s+)*';
+my $field  = RT::Interface::REST->field_spec;
 my $labels = "(?:$label,)*$label";
 
 # We must handle requests such as the following:

Modified: rt/branches/3.8-TESTING/share/html/REST/1.0/search/ticket
==============================================================================
--- rt/branches/3.8-TESTING/share/html/REST/1.0/search/ticket	(original)
+++ rt/branches/3.8-TESTING/share/html/REST/1.0/search/ticket	Mon Jun  9 13:33:52 2008
@@ -54,12 +54,13 @@
 $fields => undef
 </%ARGS>
 <%INIT>
+use RT::Interface::REST;
 my $output = "";
 my $status = "200 Ok";
 my $tickets = new RT::Tickets $session{CurrentUser};
 
 # Parse and validate any field specifications.
-my $field  = '[a-zA-Z](?:[a-zA-Z0-9_-]|\s+)*';
+my $field  = RT::Interface::REST->field_spec;
 my (%fields, @fields);
 if ($fields) {
     $format ||= "l";


More information about the Rt-commit mailing list