X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~webstump/git?a=blobdiff_plain;f=stump%2Fbin%2FdecodeBase64;h=3eff5b240115833098acfe984d2d80cd19e5c8f9;hb=4aa83920889add254f76745a96a85e51bc2f11cc;hp=61a025b3b19924a536494c1099039a0aca7dd5b1;hpb=acff1ba7277dfa00ee47688742f2a3910ea6c106;p=modbot-mtm.git diff --git a/stump/bin/decodeBase64 b/stump/bin/decodeBase64 index 61a025b..3eff5b2 100755 --- a/stump/bin/decodeBase64 +++ b/stump/bin/decodeBase64 @@ -4,6 +4,7 @@ $isEncoded = 0; $FullHeaders = ""; $DecodedHeaders = ""; $switch = ""; +$inctype = 0; while(<>) { chop; @@ -12,6 +13,12 @@ while(<>) { $FullHeaders .= "$_\n"; + if ( /^\s+/ && $inctype ) { + next; + } + + $inctype=0; + if( /^Content-Transfer-Encoding: BASE64/i ) { $isEncoded = 1; @@ -22,6 +29,9 @@ while(<>) { $isEncoded = 1; $switch = "-q"; # quoted-printable + } elsif( /^Content-Type: /i ) { + $inctype = 1; + } elsif( ! /^Mime-Version: /i && ! /Content-Type: /i ) { $DecodedHeaders .= "$_\n"; }