From: Owen Dunn Date: Thu, 9 Oct 2014 12:34:44 +0000 (+0100) Subject: bodge decodeBase64 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~webstump/git?p=modbot-mtm.git;a=commitdiff_plain;h=4aa83920889add254f76745a96a85e51bc2f11cc bodge decodeBase64 Signed-off-by: Ian Jackson --- 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"; }