[Rt-commit] rt branch, 4.0/check-paths-for-cssjsfiles, created. rt-4.0.2-190-g58129dd
Kevin Falcone
falcone at bestpractical.com
Thu Oct 13 19:01:32 EDT 2011
The branch, 4.0/check-paths-for-cssjsfiles has been created
at 58129dd4e4a5b9fa874a85bc46278c93468b2d0e (commit)
- Log -----------------------------------------------------------------
commit 58129dd4e4a5b9fa874a85bc46278c93468b2d0e
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Thu Oct 13 18:55:32 2011 -0400
Error check files before calling scomp
Without this, adding a bad file path to CSSFiles or JSFiles will
cause RT to just die on page load. Now we warn about the bad file
and continue serving RT.
diff --git a/lib/RT/Squish/CSS.pm b/lib/RT/Squish/CSS.pm
index de6c50c..d3e92f0 100644
--- a/lib/RT/Squish/CSS.pm
+++ b/lib/RT/Squish/CSS.pm
@@ -87,7 +87,16 @@ subclass CSS::Squish::file_handle for RT
sub file_handle {
my $self = shift;
my $file = shift;
- my $content = $HTML::Mason::Commands::m->scomp("/NoAuth/css/$file") || '';
+
+ my $path = "/NoAuth/css/$file";
+ my $content;
+ if ( $HTML::Mason::Commands::m->comp_exists($path) ) {
+ $content = $HTML::Mason::Commands::m->scomp("$path");
+ } else {
+ RT->Logger->error("Unable to open $path for CSS Squishing");
+ return undef;
+ }
+
open( my $fh, '<', \$content ) or die $!;
return $fh;
}
diff --git a/lib/RT/Squish/JS.pm b/lib/RT/Squish/JS.pm
index 4841a9c..e2d7f0a 100644
--- a/lib/RT/Squish/JS.pm
+++ b/lib/RT/Squish/JS.pm
@@ -76,7 +76,13 @@ sub Squish {
my $content;
for my $file ( RT->Config->Get('JSFiles') ) {
- $content .= $HTML::Mason::Commands::m->scomp("/NoAuth/js/$file");
+ my $path = "/NoAuth/js/$file";
+ if ( $HTML::Mason::Commands::m->comp_exists($path) ) {
+ $content .= $HTML::Mason::Commands::m->scomp($path);
+ } else {
+ RT->Logger->error("Unable to open $path for JS Squishing");
+ next;
+ }
}
return $self->Filter($content);
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list