From ef0333f5da300072a87d6572443e67dcea2c6da7 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Fri, 21 Mar 2014 11:04:56 +0100 Subject: filter-github-emails: Strip leading blank lines Email::MIME sometimes prepends an empty line when returning an email as string :-/ diff --git a/libexec/filter-github-emails b/libexec/filter-github-emails index 5abf1b0..85ec1a3 100755 --- a/libexec/filter-github-emails +++ b/libexec/filter-github-emails @@ -140,6 +140,18 @@ sub rewrap { } # +# Write the email to STDOUT. +# +sub print_email { + my $email = shift; + my $text = $email->as_string; + + # Email::MIME sometimes prepends an empty line :-/ + $text =~ s/^[\r\n]+//; + print $email->as_string; +} + +# # Look up MIME parts. # @@ -260,7 +272,7 @@ sub handle_github_mail { $email->header_obj_set(edit_header($email->header_obj, COMMENTS_TO, 'GitHub comment')); } - print $email->as_string; + print_email($email); } sub handle_non_github_mail { @@ -268,7 +280,7 @@ sub handle_non_github_mail { notice('Received a non-GitHub message'); # Just spit out the email as-is. - print $email->as_string; + print_email($email); } # -- cgit v0.10-9-g596f