fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-12-14 05:25 am

[dw-free] "$r->post_args || $r->get_args" construct longer works

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

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

$r->post_args / $r->get_args returns a blessed object, even when there are
no post or get args, so the fallback is never used. Do an explicit check
instead.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/DW/Controller/Admin/MemcacheClear.pm
  • cgi-bin/DW/Controller/Admin/ThemeMetadata.pm
--------------------------------------------------------------------------------
diff -r e310992a7e9d -r fc184e7b10b5 cgi-bin/DW/Controller/Admin/MemcacheClear.pm
--- a/cgi-bin/DW/Controller/Admin/MemcacheClear.pm	Sun Dec 11 04:49:39 2011 +0800
+++ b/cgi-bin/DW/Controller/Admin/MemcacheClear.pm	Wed Dec 14 12:56:13 2011 +0800
@@ -53,7 +53,7 @@
     return $rv unless $ok;
 
     my $r = DW::Request->get;
-    my $args = $r->post_args || $r->get_args || {};
+    my $args = $r->did_post ? $r->post_args : $r->get_args;
 
     my $vars = {
         %$rv,
diff -r e310992a7e9d -r fc184e7b10b5 cgi-bin/DW/Controller/Admin/ThemeMetadata.pm
--- a/cgi-bin/DW/Controller/Admin/ThemeMetadata.pm	Sun Dec 11 04:49:39 2011 +0800
+++ b/cgi-bin/DW/Controller/Admin/ThemeMetadata.pm	Wed Dec 14 12:56:13 2011 +0800
@@ -71,7 +71,7 @@
 
     my $r = DW::Request->get;
 
-    my $args = $r->post_args || $r->get_args || {};
+    my $args = $r->did_post ? $r->post_args : $r->get_args;
     my $uniq = $args->{theme};
  
     my $pub = LJ::S2::get_public_layers();
@@ -171,7 +171,7 @@
 
     my $r = DW::Request->get;
 
-    my $args = $r->post_args || $r->get_args || {};
+    my $args = $r->did_post ? $r->post_args : $r->get_args;
     my $cat = $args->{category};
 
     $cat = undef unless _validate_category( $cat );
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org