[Rt-commit] rt branch, additional-features-munge-attachments, created. rt-5.0.0-4-gb33f90ae96

Craig Kaiser craig at bestpractical.com
Wed Aug 12 16:56:22 EDT 2020


The branch, additional-features-munge-attachments has been created
        at  b33f90ae96b970502bbb0e619e9affd22e20a970 (commit)

- Log -----------------------------------------------------------------
commit b33f90ae96b970502bbb0e619e9affd22e20a970
Author: craig kaiser <craig at bestpractical.com>
Date:   Wed Aug 12 15:01:09 2020 -0400

    Allow header and content munging to be disabled by flags

diff --git a/sbin/rt-munge-attachments.in b/sbin/rt-munge-attachments.in
index a0869441e4..67ffd2c697 100644
--- a/sbin/rt-munge-attachments.in
+++ b/sbin/rt-munge-attachments.in
@@ -70,7 +70,7 @@ BEGIN {    # BEGIN RT CMD BOILERPLATE
 # Read in the options
 my %opts;
 use Getopt::Long;
-GetOptions( \%opts, "help|h", "search=s", "replacement=s", 'tickets=s' );
+GetOptions( \%opts, "help|h", "search=s", "replacement=s", 'tickets=s', 'no-headers', 'no-content' );
 
 if ( $opts{'help'} || !$opts{'search'} ) {
     require Pod::Usage;
@@ -81,6 +81,8 @@ if ( $opts{'help'} || !$opts{'search'} ) {
 use RT -init;
 
 my $replacement = $opts{'replacement'} || '';
+my $headers     = $opts{'no-headers'} ? 0 : 1;
+my $content     = $opts{'no-content'} ? 0 : 1;
 
 my $search = $opts{'search'};
 
@@ -113,6 +115,8 @@ else {
 }
 
 my ( $ret, $msg ) = $attachments->ReplaceAttachments(
+    Headers     => $headers,
+    Content     => $content,
     Search      => Encode::decode( 'UTF-8', $search ),
     Replacement => Encode::decode( 'UTF-8', $replacement ),
     $opts{tickets} ? ( FilterBySearchString => 0 ) : (),
@@ -167,4 +171,14 @@ specified, RT will pre-filter attachments by the search string use SQL,
 which might bypass attachments of which contents are encoded(like
 base64). Use this option to prevent the pre-filter behavior.
 
+=item --no-headers
+
+BY default headers are also munged, to disable munging of headers set the
+--no-headers flag.
+
+=item --no-content
+
+BY default transaction content is munged, to disable munging of content set the
+--no-content flag.
+
 =back

-----------------------------------------------------------------------


More information about the rt-commit mailing list