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-07-05 10:39 am

[dw-free] strip use of background images/positioning in comment content

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

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

Strip margin/heights in comments.

Patch by [staff profile] denise.

Files modified:
  • cgi-bin/cleanhtml.pl
--------------------------------------------------------------------------------
diff -r 70e2dbccee35 -r 5b84bd8fb073 cgi-bin/cleanhtml.pl
--- a/cgi-bin/cleanhtml.pl	Sun Jul 05 10:24:51 2009 +0000
+++ b/cgi-bin/cleanhtml.pl	Sun Jul 05 10:38:48 2009 +0000
@@ -145,6 +145,7 @@ sub clean
     my $suspend_msg = $opts->{'suspend_msg'} || 0;
     my $unsuspend_supportid = $opts->{'unsuspend_supportid'} || 0;
     my $to_external_site = $opts->{to_external_site} || 0;
+    my $remove_positioning = $opts->{'remove_positioning'} || 0;
 
     my @canonical_urls; # extracted links
     my %action = ();
@@ -647,6 +648,10 @@ sub clean
                             if ($remove_fonts) {
                                 $hash->{style} =~ s/font-family:.*?(?:;|$)//gi;
                             }
+                            if ($remove_positioning) {
+                                $hash->{style} =~ s/margin.*?(?:;|$)//gi;
+                                $hash->{style} =~ s/height\s*?:.*?(?:;|$)//gi;
+                            }
                         }
 
                         if ( $opts->{'clean_js_css'} && LJ::is_enabled('css_cleaner') ) {
@@ -1381,6 +1386,7 @@ sub clean_comment
         'tablecheck' => 1,
         'nocss' => $opts->{'nocss'},
         'textonly' => $opts->{'textonly'} ? 1 : 0,
+        'remove_positioning' => 1,
     });
 }
 
--------------------------------------------------------------------------------

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