Subject: Developers of Sympa
List archive
- From: Alfonso Marín Marín <address@concealed>
- To: address@concealed
- Subject: [sympa-dev] Improving urlize behaviour
- Date: Tue, 31 May 2011 10:48:01 +0200
Hi All,
We have activated 'urlize' reception mode in some heavy internal lists to save space in users mailboxes. It is working fine, but we have noticed a behaviour that can be improved, from our point of view.
When an user with a graphic signature send a message with an attached file, or an user send a message with embedded images and an attached file, sympa 'urlize' the file but also it 'urlize' the html part. That occurs because the mail client creates the html message inside a "multipart/related" MIME part and this part is greater than 'urlize_min_size'.
An obvious solution could be to increase 'urlize_min_size', but then there is the risk of passing some attachments 'un-urlized', loosing the adventages of 'urlize' reception mode.
We think that a better solution would be to 'urlize' the parts inside the 'multipart/*' part, instead of the whole part itself.
I propose a patch to do this. Inside List::_urlize_part, if the part hasn't got a recommended_filename, and the part is 'multipart/*', we pass this part throw List::_urlize_part again.
I would appreciate your point of view, because I don't know if I'm missing something or this is not a good idea for any reason.
Regards.
--
Alfonso Marín Marín
Sección de Telemática - ATICA
Universidad de Murcia
http://www.um.es/atica
Tlf: 868 88 87 42
--- List.pm.orig 2011-05-31 10:31:52.000000000 +0200 +++ List.pm 2011-05-31 10:33:08.000000000 +0200 @@ -10694,6 +10694,20 @@ if ($head->recommended_filename) { $filename = $head->recommended_filename; } else { + if ($head->mime_type =~ /multipart\//i) { + my $content_type = $head->get('Content-Type'); + $content_type =~ s/multipart\/[^;]+/multipart\/mixed/g; + $message->head->replace('Content-Type', $content_type); + my @parts = $message->parts(); + foreach my $i (0..$#parts) { + my $entity = &_urlize_part ($message->parts ($i), $list, $dir, $i, $mime_types, &Conf::get_robot_conf($robot, 'wwsympa_url')) ; + if (defined $entity) { + $parts[$i] = $entity; + } + } + ## Replace message parts + $message->parts (\@parts); + } $filename ="msg.$i".$fileExt; }
- [sympa-dev] Improving urlize behaviour, Alfonso Marín Marín, 05/31/2011
Archive powered by MHonArc 2.6.19+.