mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2010-05-02 06:16 am

[dw-free] Missing 'to' argument in LJ.XMLRPC.sendmessage method returns Error#100 instead of Error#2

[commit: http://hg.dwscoalition.org/dw-free/rev/da3a730cf0ef]

http://bugs.dwscoalition.org/show_bug.cgi?id=2551

Return error 200 (missing arguments) which is more correct than the
previously returned error 100 when the 'to' argument was missing.

Patch by [personal profile] mayank.

Files modified:
  • cgi-bin/ljprotocol.pl
--------------------------------------------------------------------------------
diff -r 87ceae173243 -r da3a730cf0ef cgi-bin/ljprotocol.pl
--- a/cgi-bin/ljprotocol.pl	Sun May 02 06:12:30 2010 +0000
+++ b/cgi-bin/ljprotocol.pl	Sun May 02 06:16:50 2010 +0000
@@ -490,6 +490,9 @@ sub sendmessage
     return fail($err, 213, 'found: ' . LJ::commafy($msg_len_c) . ' characters, it should exceed zero')
         if ($msg_len_c <= 0);
 
+    #test if to argument is present
+    return fail($err, 200, "to") unless exists $req->{'to'};
+    
     my @to = (ref $req->{'to'}) ? @{$req->{'to'}} : ($req->{'to'});
     return fail($err, 200) unless scalar @to;
 
--------------------------------------------------------------------------------