Skip to Content.
Sympa Menu

en - Re: [sympa-users] Filtering of HTML messages for Sympa Archives - Why ??

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Patrick Rynhart <address@concealed>
  • To: Steve Shipway <address@concealed>
  • Cc: address@concealed
  • Subject: Re: [sympa-users] Filtering of HTML messages for Sympa Archives - Why ??
  • Date: Tue, 28 May 2013 12:33:48 +1200

Thanks Steve.  An alternative way to disable the "cleaning" is simply to not call the clean_html() method in clean_archived_message in archived.pl (see below):

This does what we want - the 'security' around lists is something that we handle via moderation etc.  In short, anything that actually gets posted should be (verbatim) in the archives also.

Can I please suggest that an option to disable the archive cleaning is added to wwsympa.conf ?

Thanks,

Patrick




sub clean_archived_message{
    my $params = shift;
    &do_log('debug',"Cleaning HTML in archived file '%s/%s' (overwrite: %s).",$params->{'path'},$params->{'file'},$params->{'overwrite'});
    my $filtered_file;
    if ($params->{'overwrite'}){
        $filtered_file = $params->{'path'}.'/'.$params->{'file'};
    }else{
        $filtered_file = $Conf::Conf{'tmpdir'}.'/'.$params->{'file'};
    }
    my $file_to_archive = $params->{'path'}.'/'.$params->{'file'};
    if (my $msg = new Message($file_to_archive,1)){
-        if($msg->clean_html()){
+        if(true){
            if(open TMP, ">$filtered_file") {
                print TMP $msg->{'msg'}->as_string;
                close TMP;
                $file_to_archive = $filtered_file;
            }else{
                &do_log('err','Unable to create a tmp file to write clean HTML to file %s',$filtered_file);
                return undef;
            }
        }else{
            &do_log('err','HTML cleaning in file %s failed.',$file_to_archive);
            return undef;
        }
    }else{
        &do_log('err','Unable to create a Message object with file %s',$file_to_archive);
        return undef;
    }
    return $file_to_archive;
}



Patrick Rynhart
Systems Engineer
Infrastructure Support Section
Information Technology Services
Massey University
Palmerston North

T: +64 6 356 9099 ext 81075

On 28/05/13 12:16, Steve Shipway wrote:
We have recently upgraded from Sympa 5 to 6, and have since noticed that
archived.pl now "cleans" HTML messages (via a subroutine clean_archived_message()).
I also noticed this.  I think the rationale was that, by making links and email addresses in messages unclickable, it prevents link spam via mailing list archives and the like.

However, I don't like it... and our users want to retain clickable links in archives, as with the old MailMan system.

So, this is how to get rid of it!

First, you need to edit the file mhonarc-ressources.tt2 (yes, that double s is correct) in your Sympa config directory.  Look for the MIMEARGS definition.  Set the following options:

<MIMEARGS>
text/plain; asis=us-ascii:iso-8859-1:iso-8859-2 nonfixed quote htmlcheck maxwidth=78 link="http,https,ftp,mailto"
text/html; asis=us-ascii:iso-8859-1:iso-8859-2 allownoncidurls
m2h_external::filter; subdir usename
</MIMEARGS>

This allows the archives to make embedded URLs in archived text postings into hotlinks.

The next part requires you to modify the Sympa code... 8-O

In sympa/lib/tools.pm you need to add a couple of options to the StripScripts::Parser.  Around line 111 or so, add the AllowHref=>1 and AllowMailto=>1 (if you want mailto links as well):

      my $hss = HTML::StripScripts::Parser->new({ Context => 'Document',
                                                AllowSrc        => 1,
                                                AllowHref => 1,  #ADDED
                                                AllowMailto => 1, #ADDED
                                                Rules => {

This stops the links from being removed in HTML emails when viewing the archives.

Ideally, this behaviour should be set via an option in the wwsympa.conf, but...

My version is 6.1.11; I doubt there are many changes in other 6.1.x but you may find it different in 6.2a.x

Steve


Steve Shipway
ITS Unix Services Design Lead
University of Auckland, New Zealand
Floor 1, 58 Symonds Street, Auckland
Phone: +64 (0)9 3737599 ext 86487
DDI: +64 (0)9 923 6487
Mobile: +64 (0)21 753 189
Email: address@concealed
 Please consider the environment before printing this e-mail : 打印本邮件,将减少一棵树存活的机会



GIF image




Archive powered by MHonArc 2.6.19+.

Top of Page