Not an elegant solution to the Mac meta-data problem, but at least it
allows one to
clear out problem attachments by allowing you to search for tiny
attachments rather
than just giant ones; now if only there were a duplicate attachment
hard-linker... ;-)
Next I think I'll try amending html2mime to discard the smaller of a
pair of duplicate
named attachments if it is less than 2k & 10% of the larger.
--
Cambridge Energy Alliance: Save money & the planet
--- /opt/src/rt-3.8.1/lib/RT/Shredder/Plugin/Attachments.pm 2008-08-18 11:14:10.000000000 -0400
+++ lib/RT/Shredder/Plugin/Attachments.pm 2008-10-27 12:22:18.000000000 -0400
@@ -68,15 +68,19 @@
Example: '*.xl?' or '*.gif'
-=head2 longer - attachment content size
+=head2 longer - minimum content size
-Search attachments which content is longer than specified.
-You can use trailing 'K' or 'M' character to specify size in
-kilobytes or megabytes.
+Find attachments whose content is longer than specified.
+You can append 'K' or 'M' to specify size in kilobytes or megabytes.
+
+=head2 shorter - maximum content size
+
+Find attachments whose content is shorter than specified.
+You can append 'K' or 'M' to specify size in kilobytes or megabytes.
=cut
-sub SupportArgs { return $_[0]->SUPER::SupportArgs, qw(files_only file longer) }
+sub SupportArgs { return $_[0]->SUPER::SupportArgs, qw(files_only file longer shorter) }
sub TestArgs
{
@@ -89,9 +93,9 @@
}
$args{'file'} = $self->ConvertMaskToSQL( $args{'file'} );
}
- if( $args{'longer'} ) {
- unless( $args{'longer'} =~ /^\d+\s*[mk]?$/i ) {
- return( 0, "Invalid file size argument '$args{longer}'" );
+ if( my $size = $args{'longer'}||$args{'shorter'} ) {
+ unless( $size =~ /^\d+\s*[mk]?$/i ) {
+ return( 0, "Invalid file size argument '$size'" );
}
}
return $self->SUPER::TestArgs( %args );
@@ -110,12 +114,13 @@
if( $self->{'opt'}{'files_only'} ) {
push @conditions, "( LENGTH(Filename) > 0 )";
}
- if( $self->{'opt'}{'longer'} ) {
- my $size = $self->{'opt'}{'longer'};
+ if( my $size = $self->{'opt'}{'longer'}||$self->{'opt'}{'shorter'} ) {
$size =~ s/([mk])//i;
$size *= 1024 if $1 && lc $1 eq 'k';
$size *= 1024*1024 if $1 && lc $1 eq 'm';
- push @conditions, "( LENGTH(Content) > ? )";
+ push @conditions, '( LENGTH(Content)'.
+ ($self->{'opt'}{'longer'} ? '>' : '<' )
+ .'? )';
push @values, $size;
}
return (0, "At least one condition should be provided" ) unless @conditions;
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com