[Rt-devel] PATCH: submission of '0' via REST interface

David Schweikert dws at ee.ethz.ch
Tue Apr 25 02:31:35 EDT 2006


Hi Jesse,

Is it ok like this?

Cheers
David

--- RT/Interface/REST.pm	2006-04-21 15:46:18.693515000 +0200
+++ RT/Interface/REST.pm	2006-04-25 08:29:11.955808000 +0200
@@ -110,8 +110,11 @@
             }
             elsif ($state <= 1 && $line =~ /^($field):(?:\s+(.*))?$/) {
                 # Read a field: value specification.
-                my $f  = $1;
-                my @v  = ($2 || ());
+                my ($f, $vtmp) = ($1, $2);
+                # Only return the value if non-empty (so that specifying
+                # an empty string will set the field to NULL instead of the
+                # empty string)
+                my @v = ($vtmp =~ /\S/ ? ($vtmp) : ());
 
                 # Read continuation lines, if any.
                 while (@lines && ($lines[0] eq '' || $lines[0] =~ /^\s+/)) {

-- 
David Schweikert        | phone: +41 44 632 7019
System manager ISG.EE   | walk:  ETH Zentrum, ETL F24.1
ETH Zurich, Switzerland | web:   http://people.ee.ethz.ch/dws


More information about the Rt-devel mailing list