[Jifty-commit] jifty branch, master, updated. 1.10518-38-g0e4c9f5
Jifty commits
jifty-commit at lists.jifty.org
Wed Jul 13 14:07:40 EDT 2011
The branch, master has been updated
via 0e4c9f566e159b199760e7371c3fb5da2880fcf3 (commit)
from e9b1b8145f96e66202dfd51527d34393f1c55d10 (commit)
Summary of changes:
lib/Jifty/Plugin/CompressedCSSandJS.pm | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit 0e4c9f566e159b199760e7371c3fb5da2880fcf3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Jul 13 14:06:40 2011 -0400
Redispatch wrong relative-path CSS/JS requests from the squished versions
diff --git a/lib/Jifty/Plugin/CompressedCSSandJS.pm b/lib/Jifty/Plugin/CompressedCSSandJS.pm
index 542daa6..8000cba 100644
--- a/lib/Jifty/Plugin/CompressedCSSandJS.pm
+++ b/lib/Jifty/Plugin/CompressedCSSandJS.pm
@@ -265,4 +265,27 @@ sub _js_is_skipped {
return grep { $file eq $_ } @{ $self->skipped_js };
}
+=head2 wrap
+
+If a JS or CSS file references another by a relative path, it will most
+likely end up being mis-requested under the CAS directory. Catch those
+requests, warn about them, and re-dispatch them internally to what is
+likely the right place.
+
+=cut
+
+sub wrap {
+ my ($self, $app) = @_;
+ return sub {
+ my $env = shift;
+ if (my ($arg, $type) = $env->{PATH_INFO} =~ m{/__jifty/cas/ccjs/(.*?)\.(js|css)$}) {
+ if ($arg !~ /^[0-9a-fA-F]{32}$/ and not Jifty::CAS->key("ccjs",$arg)) {
+ $self->log->warn("Request for relative path $type file: $arg.$type");
+ $env->{PATH_INFO} = "/static/$type/$arg.$type";
+ }
+ }
+ $app->($env);
+ };
+}
+
1;
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list