afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-12-17 02:01 pm

[dw-free] Uploading oversized image from URL fails with bad error

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

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

Proper checking for images from URL with a too-large filesize.

Patch by [personal profile] grimsniffer.

Files modified:
  • htdocs/editpics.bml
--------------------------------------------------------------------------------
diff -r 3b04b672b92e -r dde231e4bf1b htdocs/editpics.bml
--- a/htdocs/editpics.bml	Wed Dec 16 09:29:17 2009 +0000
+++ b/htdocs/editpics.bml	Thu Dec 17 14:00:51 2009 +0000
@@ -836,7 +836,8 @@ sub parse_post_uploads
                     my $res = $ua->get($POST{$userpic_key});
                     $current_upload{image} = \$res->content if $res && $res->is_success;
                     $current_upload{error} = $ML{'.error.urlerror'} unless $current_upload{image};
-                    $current_upload{error} = $ML{'.error.urlfiletoolarge'} if length($current_upload{image}) > $MAX_UPLOAD;
+                    #Below, $current_upload{image} needs to be dereferenced because it contains a hash value.
+                    $current_upload{error} = $ML{'.error.urlfiletoolarge'} if length( ${ $current_upload{image} } ) > $MAX_UPLOAD;
                 }
                 push @uploads, \%current_upload;
             }
--------------------------------------------------------------------------------

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