[Rt-commit] r7816 - in rt/branches/3.7-EXPERIMENTAL-TUNIS: html/REST/1.0

clsung at bestpractical.com clsung at bestpractical.com
Thu May 10 22:54:32 EDT 2007


Author: clsung
Date: Thu May 10 22:54:31 2007
New Revision: 7816

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/   (props changed)
   rt/branches/3.7-EXPERIMENTAL-TUNIS/html/REST/1.0/dhandler

Log:
 r1041 at going04:  clsung | 2007-05-11 00:09:30 +0800
 - fix warning of uninitialized values
 - should match the semantics (pass tests)


Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/html/REST/1.0/dhandler
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/html/REST/1.0/dhandler	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/html/REST/1.0/dhandler	Thu May 10 22:54:31 2007
@@ -100,20 +100,19 @@
         if (my ($type, $oids, $extra) =
             ($id =~ m#^($name)/($list|$labels)(?:(/.*))?$#o))
         {
+	    $extra ||= '';
+	    my ($attr, $args) = $extra =~ m{^(?:/($name)(?:/(.*))?)?$}o;
+	    my $tids;
+	    if ($attr and $attr eq 'history' and $args) {
+	       	($tids) = $args =~ m#id/(\d.*)#o;
+	    }
+	    # expand transaction and attachment range specifications
+	    # (if applicable)
 	    foreach my $oid (expand_list($oids)) {
-		if ($extra =~ m{^(?:/($name)(?:/(.*))?)?$}o) {
-		    my ($attr, $args) = ($1, $2);
-		    # expand transaction and attachment range specifications
-		    # (if applicable)
-		    my $tids;
-		    if ($attr eq 'history' && $args =~ m#id/(\d.*)#o) {
-			$tids = $1;
-		    }
-		    if ($tids) {
-			push(@objects, "$type/$oid/$attr/id/$_") for expand_list($tids);
-		    } else {
-			push(@objects, "$type/$oid$extra");
-		    }
+		if ($tids) {
+		    push(@objects, "$type/$oid/$attr/id/$_") for expand_list($tids);
+		} else {
+		    push(@objects, "$type/$oid$extra");
 		}
 	    }
 	}
@@ -145,7 +144,7 @@
             # Look for matching types in the ID, form, and URL.
             $type = exists $k->{type} ? $k->{type} : $utype;
             $type =~ s|^(?:$utype)?|$utype/| if $utype;
-            $type =~ s|/$||;
+            $type =~ s|/$|| if $type;
 
             if (exists $k->{id}) {
                 $id = $k->{id};


More information about the Rt-commit mailing list