[Rt-commit] r11435 - rt/branches/3.8-TESTING/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Thu Apr 3 07:58:56 EDT 2008


Author: ruz
Date: Thu Apr  3 07:57:18 2008
New Revision: 11435

Modified:
   rt/branches/3.8-TESTING/lib/RT/Template_Overlay.pm

Log:
* report error in logs when template has not empty first line
  and it doesn't look like header. As well add that empty line
  there.

Modified: rt/branches/3.8-TESTING/lib/RT/Template_Overlay.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/Template_Overlay.pm	(original)
+++ rt/branches/3.8-TESTING/lib/RT/Template_Overlay.pm	Thu Apr  3 07:57:18 2008
@@ -303,6 +303,16 @@
     my ($content, $msg) = $self->_ParseContent(@_);
     return ( 0, $msg ) unless defined $content && length $content;
 
+    if ( $content =~ /^\S/s && $content !~ /^\S+:/ ) {
+        $RT::Logger->error(
+            "Template #". $self->id ." has leading line that doesn't"
+            ." look like header field, if you don't want to override"
+            ." any headers and don't want to see this error message"
+            ." then leave first line of the template empty"
+        );
+        $content = "\n".$content;
+    }
+
     #Lets build our mime Entity
 
     my $parser = MIME::Parser->new();


More information about the Rt-commit mailing list